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

Martin Peach martin.peach at sympatico.ca
Sun Feb 22 23:30:18 CET 2009

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 
"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. 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 
and see if anything changes.


More information about the Pd-list mailing list