sockets

How do I generate a connection reset programatically?

Hi, I'm sure you've seen the "the connection was reset" message displayed when trying to browse web pages. (The text is from Firefox, other browsers differ.) I need to generate that message/error/condition on demand, to test workarounds. So, how do I generate that condition programmatically? (How to generate a TCP RST from PHP -- or...

Lag before disconnect after connecting to web service

Hi, when connecting to a web service such as Amazon or Yahoo, I find there is a one or two second delay after the data has been sent and before the service disconnects. I used to program with Perl and solved this by using a regular expression to match the end of the data, then break out of the loop. For example: while ($line = <SOCKET>...

Which is better for local IPC, POSIX message queues (mqueues) or Unix domain (local) sockets?

Is it better to use POSIX message queues or Unix domain sockets for local IPC communication? I have worked with Unix sockets between machines (not domain) and I remember that making and breaking the connection would cause sockets to linger awhile before they finally went away. Moreover, if you wanted a "reliable" exchange you either had...

Socket/Proxy problem in java

I have a socket connecting to a proxy then to a remote server i specify. However i want multiple connections to the remove server from the proxy. So i want to create 4 sockets to the same proxy and from the 4 sockets connect to the remote server. When i do this it doesn't work, it only connects to the proxy once. Here is psuedo code: ...

Android Porting on Telechips TCC89XX: Not able to start init process

Hello I have started to port Android on TCC89XX board, I download Android SDK. and applied the patch with kernel 2.6.29, the Processor is having armv6 instruction set. I am not able to see the network up ifconfig is not able to show the network devices. Also I do not get why there is no "on" binary in the system/bin, system/xbin, the...

What is QTcpSocket's behaviour when the network is overloaded?

I have a QTcpSocket in a seperate thread sending a lot of data. Several of these applications are spread out over the network. How can I detect whether my network is overloaded and my socket is not able to send anything anymore? Will QTcpSocket buffer all data, how can I see the size of my buffered data that is queueing to be sent? Will...

Which Posix socket errors may be recoverable?

Suppose I have established a connection on a socket and got a Posix error code while sending or receiving a packet: one of those listed at the end of this page. On which errors I should not close the socket because trying to send/receive on the same socket again may work? ...

Erlang gen_tcp:recv(Socket, Length) semantics

After reading this answer, I want to understand if the same applies to the calls to gen_tcp:recv(Socket, Length). My understanding of the documentation is that this if more than Length bytes are available in the buffer, they remain there; if there is less than Length bytes, the call blocks until enough is available or connection closes. ...

Problem in receiving TCP/IP socket data in C#

I am receiving 3144 bytes of data through TCP/IP socket during debug mode, but in excecution 1023 bytes were received. Why isn't the remaining data read? IPEndPoint ipEnd = new IPEndPoint(ipAdd, ipPort); Socket soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); soc.Connect(ipEnd); byte[] sendData = Encodi...

Good timeout for heartbeating proto using TCP - Java Sockets

Im implementing my own proto in Java, it will use a heartbeat over a TCP connection that I also use to transfer messages and files. For the client I am using blocking socket I/O. So here is how Im planning that will work... I will set the socket timeout for K seconds and make the heartbeat stay sending messages in an interval T, so that ...

Disconnecting TCPClient and seeing that on the other side.

i am trying to disconnect a client from a server but the server still sees it as being connected. I cant find a solution to this and Shutdown, Disconnect and Close all dont work. Some code for my disconnect from the client and checking on the server: Client: private void btnDisconnect_Click(object sender, EventArgs e) { ...

Socket.Connect with a IPv6 address throws a "Address Family Not supported" Error

I am trying to do a Socket.Connect() and when the IP address that i specify is in ipv6 format, the Socket.Connect() fails with the error message : Address family not supported by protocol family. An address incompatible with the requested protocol was used. All sockets are created with an associated address family (that is, AF_INET for ...

How can I add encryption to my own TCP-based-Protocol using Java Sockets?

So, I have a working protocol that the Client needs to authenticate with user and password to login on the server. Then server and client would trade messages and files. It´s all working OK and I´m using Input/Output Stream for that. I need to add encryption to the conversation and user/password authentication too. I dont want to store a...

CFSocket weirdness running under rosetta

I have a rather large library that negotiates communication between a server and clients. The sockets use the kCFSocketDataCallback flag to enable getting data out of the connection. The library has been working very well for a long time. Now i am trying to load it up into a PPC app that runs under rosetta on intel machines. The load goe...

Are there constants for PHP socket error codes?

I'm connecting to a remote host as follows: $conn = stream_socket_client("ssl://$host:$port", $e_code, $e_string, 2, STREAM_CLIENT_CONNECT, $ctx); How should I interpret the error code? The docs say the error code "holds the system level error number that occurred in the system-level connect() call." I can't find any PHP constants w...

Python socket send EOF

I have a simple file transfer socket program where one socket sends file data and another socket receives the data and writes to a file I need to send an acknowledgment once transfer is finished from the destination to the source Code for destination s.accept() f = s.makefile() f.read(1024) Code for source s.connect(('localhost',609...

Python asyncore with very low timeout

I have written a program that communicates with many servers at once using the asyncore module. For the most part I am just responding to data received from the servers, but occasionally I need to send some data "out-of-sync". With the default timeout of 30 seconds there is an obvious delay before the packet gets sent, so I have lowered ...

Windows PGM socket access error with non-admin account

I'm trying to use PGM sockets to send data on Windows. I can listen and receive data fine from a PGM socket using a non-admin account, but when I try to create a socket to send data I get an exception at this step: socket.Bind(new IPEndPoint(IPAddress.Any, 0)); The exception is: An attempt was made to access a socket in a way forbidde...

Android application: SocketException permission denied (No such file or directory)

I am trying to use the code written and uploaded by Fedor posted in this thread http://stackoverflow.com/questions/541966/android-how-do-i-do-a-lazy-load-of-images-in-listview (Source code: http://open-pim.com/tmp/LazyList.zip) Fedor's project works well, but when I try to adapt the code to my project, things are not running well since...

Why is Socket.BeginReceive losing packets from UDP?

The following code waits for data over UDP. I have a test function that sends 1000 packets (datagrams?) of 500 bytes each. Each time I run the test function, the receiver gets only the first few dozen packets but drops the rest. I looked at the incoming network data using Wireshark and I see all 1000 packets are actually received, but ju...