How to flush a socket

I

iceman

Hi all,
HOw can I flush the socket.
eg
how can I ensure that the send takes place immediately

if (send(socketDescriptor, buf, strlen(buf) + 1, 0) < 0) {

int km=socketDescriptor.flush();
cerr << "cannot send data ";
close(socketDescriptor);
exit(1);
}
 
I

iceman

sorry it was supposed to be,

if (send(socketDescriptor, buf, strlen(buf) + 1, 0) < 0) {

cerr << "cannot send data ";
close(socketDescriptor);
exit(1);
}
 
S

Sam

iceman said:
Hi all,
HOw can I flush the socket.

There's no such thing as a "socket" in the C++ language. You must be
referring to a resource that's provided by your operating system. This
newsgroup is for the discussion of the C++ language. Try asking in a
newsgroup or a mailing list that's more appropriate for your operating
system.

Generally, the BSD socket API does not define a mechanism to verify
succesful transmission of data over a socket. Eventually, if the receiver
fails to ACK, the socket will be marked as broken, and writes will fail, but
this will not happen until quite some time has elapsed.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBHmTeHx9p3GYHlUOIRAoEaAJ4uYEUfL4ESAETeVxCjIFnb7FLWogCePJVd
9OY+hxV6wWYGZOVSdUCqoNw=
=mjoX
-----END PGP SIGNATURE-----
 
D

Dennis Jones

iceman said:
Hi all,
HOw can I flush the socket.

When I first read the subject line, my brain read it as, "How to flush a
toilet." I guess I've been sitting here at my desk too long! :)

- Dennis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top