SDL_net - SDLNet_TCP_Send problem

Hi,

I’ve noticed a strange behaviour in the tcpserver/tcpclient example provided with the SDL_net bundle.

Assuming the tcpserver is running and a tcpclient connected to it. Now, if I kill the tcpserver and send from tcpclient whatever you want to the (killed) tcpserver (for example: ‘tux’), the returned length by SDLNet_TCP_Send is 4 (t, u,x and \0) but I think (perhaps I’m wrong) the corrected returned length should be 0 as the tcpserver is down, typically meaning that an error occured, in that case, the tcpserver disconnecting.

Does anyone have any ideas how I can fix this problem. Is this a normal behaviour of SDLNet_TCP_Send ?

thanks!

[I’m working on Fedora core 1, Redhat 7.2 and WinXp with SDL-1.2.7 and SDL_net 1.2.5]

Sam

— Samuel Marin wrote:

Hi,

I’ve noticed a strange behaviour in the
tcpserver/tcpclient example provided with the
SDL_net bundle.

Assuming the tcpserver is running and a tcpclient
connected to it. Now, if I kill the tcpserver and
send from tcpclient whatever you want to the
(killed) tcpserver (for example: ‘tux’), the
returned length by SDLNet_TCP_Send is 4 (t, u,x and
\0) but I think (perhaps I’m wrong) the corrected
returned length should be 0 as the tcpserver is
down, typically meaning that an error occured, in
that case, the tcpserver disconnecting.

In POSIX write() returns -1 on error, and if you try
sending data to a disconnected server, you will get
the EPIPE error. Other possible errors.

Once, using Slackware 8, I noticed that killing server
processes sometimes seemed to leave behind a phantom
connection. Perhaps this is what you’re experiencing?>

Does anyone have any ideas how I can fix this
problem. Is this a normal behaviour of
SDLNet_TCP_Send ?

thanks!

[I’m working on Fedora core 1, Redhat 7.2 and WinXp with SDL-1.2.7 and SDL_net 1.2.5]

Sam> _______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.