Home » U++ Library support » U++ MT-multithreading and servers » Checking socket connection after send.
Checking socket connection after send. [message #14234] |
Wed, 20 February 2008 16:51 |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
I need to find the best way to check if data was sent & received successfully without implementing a return message by the receiving side. My thought has been to write the message to the socket, see if I can still write to the socket, and if I can, I can know that the message was sent successfully without transmission interruption. If I cant still write, then I know that the connection has closed prematurely. Also, I will check for errors, but the IsError() function has not detected dropped connections for me.
This would look something like:
socket.Write(message);
if(socket.PeekWrite()){
socket.Close();
return true; //
}else{
socket.Close();
return false;
}
Is this correct? Wouldnt the Write() method cause a Socket Error to be set if it could not write the whole message?
Am I interpreting PeekWrite correctly? Does it check to see if the socket is writable or if there is content waiting to be written?
Also, what does PeekAbort() do?
[Updated on: Wed, 20 February 2008 17:58] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon May 13 12:34:56 CEST 2024
Total time taken to generate the page: 0.02575 seconds
|