473,385 Members | 1,531 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,385 software developers and data experts.

TCP Send Timing Issue

I am building a simulator that needs to send out 2 messages on a tcp
connection each at a rate of 1 packet / 50ms. Right now it kind of
works in that it is sending 8 (4 of each) at 200ms. Is there a way to
force the packets to at the least go out every 50 ms?
If 1 of each is combined is fine, but 4 of each at a time is a problem.
Are there any more options I can set to improve this?
Right now my socket is setup as :
serverSocket = new Socket( AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
serverSocket.SetSocketOption(SocketOptionLevel.Soc ket,
SocketOptionName.SendTimeout, 1000);

Thanks.

Nov 10 '06 #1
5 3642
Hi,

There is no way to be 100% sure that you will send them at the required rate.
Windows is not a real time OS and your app depends of others events
happening in the OS at the same time.

The best you can do is using a Timer (I bet you are doing it anyway )

Beside that, what u consider a "packet"? It's a TCP datagram? (think this is
the correct term) if so it will depend of the network and I'm not sure if you
can go that low using the framework as to force the packet size.

"Richard Charts" wrote:
I am building a simulator that needs to send out 2 messages on a tcp
connection each at a rate of 1 packet / 50ms. Right now it kind of
works in that it is sending 8 (4 of each) at 200ms. Is there a way to
force the packets to at the least go out every 50 ms?
If 1 of each is combined is fine, but 4 of each at a time is a problem.
Are there any more options I can set to improve this?
Right now my socket is setup as :
serverSocket = new Socket( AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
serverSocket.SetSocketOption(SocketOptionLevel.Soc ket,
SocketOptionName.SendTimeout, 1000);

Thanks.

Nov 10 '06 #2
Hi Richard,

Just a guess, but try setting NoDelay to true.

--
Dave Sexton

"Richard Charts" <ri************@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
>I am building a simulator that needs to send out 2 messages on a tcp
connection each at a rate of 1 packet / 50ms. Right now it kind of
works in that it is sending 8 (4 of each) at 200ms. Is there a way to
force the packets to at the least go out every 50 ms?
If 1 of each is combined is fine, but 4 of each at a time is a problem.
Are there any more options I can set to improve this?
Right now my socket is setup as :
serverSocket = new Socket( AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
serverSocket.SetSocketOption(SocketOptionLevel.Soc ket,
SocketOptionName.SendTimeout, 1000);

Thanks.

Nov 10 '06 #3

Dave Sexton wrote:
Hi Richard,

Just a guess, but try setting NoDelay to true.

--
Dave Sexton

"Richard Charts" <ri************@gmail.comwrote in message
news:11**********************@h54g2000cwb.googlegr oups.com...
I am building a simulator that needs to send out 2 messages on a tcp
connection each at a rate of 1 packet / 50ms. Right now it kind of
works in that it is sending 8 (4 of each) at 200ms. Is there a way to
force the packets to at the least go out every 50 ms?
If 1 of each is combined is fine, but 4 of each at a time is a problem.
Are there any more options I can set to improve this?
Right now my socket is setup as :
serverSocket = new Socket( AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
serverSocket.SetSocketOption(SocketOptionLevel.Soc ket,
SocketOptionName.SendTimeout, 1000);

Thanks.
I had tried NoDelay originally and it didn't work.
This morning I looked some more and noticed the damn things needs
boolean value not an int.
serverSocket.SetSocketOption(SocketOptionLevel.Tcp ,SocketOptionName.NoDelay,
true);
It is working now.
Thank you both for your help.

Nov 13 '06 #4
"Richard Charts" <ri************@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
I had tried NoDelay originally and it didn't work.
This morning I looked some more and noticed the damn things needs
boolean value not an int.
serverSocket.SetSocketOption(SocketOptionLevel.Tcp ,SocketOptionName.NoDelay,
true);
It is working now.
Note that turning off the Nagle algorithm simply disables the performance
optimization of consolidating outbound TCP/IP packets. There are still
other ways that your data can be held up. If you have a specific need for
100% reliable constant rate data transmission, TCP/IP isn't the appropriate
transport.

Pete
Nov 13 '06 #5

Peter Duniho wrote:
"Richard Charts" <ri************@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
I had tried NoDelay originally and it didn't work.
This morning I looked some more and noticed the damn things needs
boolean value not an int.
serverSocket.SetSocketOption(SocketOptionLevel.Tcp ,SocketOptionName.NoDelay,
true);
It is working now.

Note that turning off the Nagle algorithm simply disables the performance
optimization of consolidating outbound TCP/IP packets. There are still
other ways that your data can be held up. If you have a specific need for
100% reliable constant rate data transmission, TCP/IP isn't the appropriate
transport.

Pete
It's a simulator of actual hardware that will exist in a closed LAN, so
disabling Nagle does exactly what I need. Exact timing any where
between Xms - Yms (and even that wasn't that important) was less my
concern rather than that it was important that the traffic was crossing
the network in the correct form. It was important to match the way
that the hardware being simulated was outputting packets.
Right option for the right job and all that.

Nov 13 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Timo | last post by:
When content is transferred from a hidden IFRAME (which has fetched data from a database) to a DIV in the main document, how can a script determine that the DIV has been completely populated before...
3
by: Russell | last post by:
I have a quirky issue that I believe involves timing and only 2 hairs left to pull. I have a modal dialog that is an IFrame. The IFrame contains another window - which contains the appropriate...
7
by: Jacob Barnett | last post by:
Access 2000 main report does not display subreport data in preview and may or may not print... sometimes. Usually, the entire report is fine. The behavior does not seem to depend on particular...
4
by: Brian Hanson | last post by:
Hi, I have a problem that is sporadic and am thinking it may come down to a timing issue. I have an asp.net (vb) app that used the system.io.file.copy method to copy a .pdf file from a network...
15
by: dennis.richardson | last post by:
Greetings all. Here's a problem that's been driving me nuts for the last 48 hours. I'm hoping that someone has come across this before. I have a C# Application that reads a UDP broadcast...
4
by: Nebulus | last post by:
We've got a website that's designed in classic ASP. While it's a good product, the original design was badly done, and I've inherited a monster. At some point last week, users began calling in...
2
by: julie.siebel | last post by:
Google apparently ate my original post to this (grr) so this'll be a bit more vague than the initial post, but...*sigh*. Javascript is not my forte, and I apologize for the acky-ness of the...
16
by: bgreer5050 | last post by:
I have a form with the following fields: UserEmail Subject Body When the form is submitted, the email is processed fine. When I try to add another field to the mm.body (mm.Body = Body.Text...
0
by: Daniel Fetchinson | last post by:
On 4/15/08, Daniel Fetchinson <fetchinson@googlemail.comwrote: BTW, using the following ###################################################################### # CODE TO TEST BOTH...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.