Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
captainc is currently offline  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

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Intentionally inconstistent use of "Atomic" in Mt.h?
Next Topic: Detect connection, valid URL, 404 page
Goto Forum:
  


Current Time: Tue May 07 10:43:51 CEST 2024

Total time taken to generate the page: 0.02454 seconds