As I recently started writing a new server program from scratch with the Sockets unit, I have joined the barren realm of network programming. Seriously, there are only 66 threads in this forum vs hundreds elsewhere.

My problem is as follows:
I have a socket open between many clients and the server, exchanging data very happily. However, if I close just one of the clients, I get a runtime error #141 - I have try,except block in where the data is transmitted and that calls no error, and this behaviour occurs even when the server is waiting to start the next cycle in a delay() loop. Occasionally I get error 111 on the client side if the server is closed.

I have tried to use the SocketError() procedure, and have it running in a parallel thread from the program's startup checking for error every 2ms, however it picks nothing up when the runtime error occurs.

After googling I found it has something to do with the TCP pipe being broken and SIGPIPE killing my program as it thinks that due tot he broken pipe, it cannot continue.

And no, I don't understand any of that last bit...

Any help would be greatly appreciated.