473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 8496
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: JnlSeb | last post by:
According to Sun's web site, the flush method of the OutputStream object does nothing. So, what does actually happens when you call it? At times I may see different behavior when including it...
7
by: Jon Spivey | last post by:
Experimenting with response.flush() but can't seem to get it to work. This code <% response.write "<p>started</p>" response.flush() for i = 1 to 10000000 i = i +1 next response.write...
0
by: ruhunu Gamarala | last post by:
Hi, I get the following exception periodically. does anybody what is the reason for it to throw this exception? I really appriciate if anyone can help me on this. thanks, Chinthaka at...
5
by: Simon Johnson | last post by:
I have a TCP Client class for which I use StreamWriter to send data across the network. The question I have is does the StreamWriter.Flush() method block code execution until all the data has been...
3
by: Nuno Magalhaes | last post by:
How to do a TCP socket flush in order to get the packets to their real sizes (and not accumulate) like when we send a datagram UDP. When we send UDP it comes with the real packet size, in other...
2
by: Kiran | last post by:
Hello Everybody! I am writing a networking application in python for a small piece of hardware, in which there could sometimes be timeouts. I am using sockets to communicate to this device. Data...
6
by: ppuniversal | last post by:
Can anyone tell me how to flush a socket stream in C++. I am making an Client Server application in C++ and use the send() and recv() functions. i want to flush the socket buffer as i am getting...
0
by: mike | last post by:
I have called the setsockopt() to set no delay after connecting like this way: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('192.168.10.1', 21980))...
1
by: MunkeN | last post by:
Hey there! Currently I'm working on a project that handles alot of sockets (this application is *NIX). At the moment, I got this code: char *failed = "Some info about the error, bla\r\nbla bla...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.