wxSocketClient and handling a server dropped connection

Hajo Kirchhoff mailinglists at hajo-kirchhoff.de
Fri May 2 23:45:23 PDT 2008


wxSocketClient::Is(Dis)Connected() might do the trick.

Best regards

Hajo


Derek Lee-Wo schrieb:
> I have an app with a thread for handling a socket connection to a
> server.  I'm NOT using asynchronous events.  I'm reading and writing
> on the socket and blocking
> 
> My question is how can I detect that server has dropped the connection
> while I'm blocked on a read?
> 
> The Read() returns when the connection is dropped and a call to
> Error() returns true, but a subsequent call to LastError() returns a 0
> meaning there was no error.
> 
> I guess I could _assume_ that an Error() after a read means a dropped
> connection, but I was hoping LastError() would return wxSOCKET_IOERR
> or something more appropriate.
> 
> Am I doing this wrong or is there a better way to detect that a socket
> was closed on the server end?
> 
> Derek
> _______________________________________________
> wx-users mailing list
> wx-users at lists.wxwidgets.org
> http://lists.wxwidgets.org/mailman/listinfo/wx-users
> 



More information about the wx-users mailing list