468,513 Members | 1,874 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

How to flush a socket

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);
}
Jan 25 '08 #1
3 7677
sorry it was supposed to be,

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

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

Jan 25 '08 #2
Sam
iceman writes:
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)

iD8DBQBHmTeHx9p3GYHlUOIRAoEaAJ4uYEUfL4ESAETeVxCjIF nb7FLWogCePJVd
9OY+hxV6wWYGZOVSdUCqoNw=
=mjoX
-----END PGP SIGNATURE-----

Jan 25 '08 #3

"iceman" <je******@gmail.comwrote in message
news:c6**********************************@f47g2000 hsd.googlegroups.com...
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
Jan 25 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by JnlSeb | last post: by
7 posts views Thread by Jon Spivey | last post: by
5 posts views Thread by Simon Johnson | last post: by
3 posts views Thread by Nuno Magalhaes | last post: by
2 posts views Thread by Kiran | last post: by
1 post views Thread by MunkeN | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.