[PD] pd and tcp: what to do against crashes?

Roman Haefeli reduzierer at yahoo.de
Sun Feb 22 23:59:19 CET 2009


11584 tcpserver/linux
131760 tcpclient/OS X


On Sun, 2009-02-22 at 17:30 -0500, Martin Peach wrote:
> I just tried with 2 machines having [tcpserver] (WinXP) repeatedly send 
> to [tcpclient] (Ubuntu) while I pulled out the cable from one machine. 
> The server keeps sending until it disconnects about a minute later with 
> message
> "tcpserver: not a valid socket number (-1)"
> The client however thinks it's still connected and I need to disconnect 
> before reconnecting to be able to resume communication.
> So there's no crash there.

i tested the same with different results. after having send 11584 bytes
from [tcpserver] on ubuntu to [tcpclient] on OS X, that got disconnected
from ethernet, the pd instance of [tcpserver] didn't respond anymore.
after plugging in the ethernet cable again, the client on OS X did
receive all data in one message after a few seconds. after this
happened, the server responded again. 
the difference to your test was, that i sent all data (11584 bytes) in
_less_ than a minute, so the server didn't print the message:
"tcpserver: not a valid socket number (-1)"


i also tested it the other way around: client (OS X) connects to server
(linux) and then i plugged out the cable and started sending messages
from the client to the server. the client pd instance stopped responding
after having sent 131760 bytes. i don't know, if this difference comes
from different buffer sizes on [tcpserver] and [tcpclient] or from
different implementations on both OS'. however, also here: after a few
seconds after plugging in the cable again, the server received the whole
chunk as one message and the client started to respond again.

>  It's probably the buffer overflow.
> Then I modified [tcpserver] to check if the socket is writeable first, 
> using select(). This causes messages to appear when the buffer overflows 
> instead of blocking at the send() call, but it doesn't close the socket.
> I gave select a one second timeout, which should allow time for 
> zero-logical time multiple messages to get out.
> Maybe you could try it (I just uploaded it to the svn at 
> http://pure-data.svn.sourceforge.net/viewvc/pure-data/trunk/externals/mrpeach/net/) 
> and see if anything changes.

cool! many thanks for your effort. i am happy to perform some further
tests.

roman




	
		
___________________________________________________________ 
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de





More information about the Pd-list mailing list