473,407 Members | 2,359 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,407 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 8501
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.