473,796 Members | 2,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.I nterNetwork,
SocketType.Stre am, ProtocolType.Tc p);
serverSocket.Se tSocketOption(S ocketOptionLeve l.Socket,
SocketOptionNam e.SendTimeout, 1000);

Thanks.

Nov 10 '06 #1
5 3665
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.I nterNetwork,
SocketType.Stre am, ProtocolType.Tc p);
serverSocket.Se tSocketOption(S ocketOptionLeve l.Socket,
SocketOptionNam e.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.goo glegroups.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.I nterNetwork,
SocketType.Stre am, ProtocolType.Tc p);
serverSocket.Se tSocketOption(S ocketOptionLeve l.Socket,
SocketOptionNam e.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.goo glegroups.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.I nterNetwork,
SocketType.Stre am, ProtocolType.Tc p);
serverSocket.Se tSocketOption(S ocketOptionLeve l.Socket,
SocketOptionNam e.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.Se tSocketOption(S ocketOptionLeve l.Tcp,SocketOpt ionName.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.goo glegroups.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.Se tSocketOption(S ocketOptionLeve l.Tcp,SocketOpt ionName.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.goo glegroups.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.Se tSocketOption(S ocketOptionLeve l.Tcp,SocketOpt ionName.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
2476
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 it acts upon the data? if (myIFRAME.document.readyState=='complete') myDIV.insertAdjacentHTML("afterBegin", myIFRAME.window.document.getElementById('data') ) // ... // convert text in myDIV to uppercase // code here may execute before...
3
8134
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 title. I am trying to change the title of the IFrame window to be that of the contained window title. If I uncomment the alert statement below - the title change works. Comment out the alert - and - no title change.
7
2196
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 records or data and I have not found a reliable way to reproduce the behavior. The subreport can always be generated independently and always prints. There is data in both the main report and the subreport. The link child and master fields are...
4
2645
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 drive to the local server drive. From there I use that .pdf file to create another .pdf file using a tool from ActivePDF. The problem I have is that one out of 8 or 10 times I get an error: Access to the path "c:\ActivePDF\watever.pdf" is...
15
8415
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 (asynchronously). Then it repackages these UDP packets and sends them to a subscriber via TCP. Now, I can read the UDP stream all day long without the application
4
3166
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 and complaining that their sessions were timing out after minutes instead of the 120 minute session timeout that's set in the global.asa Now, at any given time, we have about 100 people logged into the site. I did perform a check, and at any...
2
1548
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 code. I'm working on a page for a travel company. There's way too much going on with it/on it, but I'm kind of stuck at this point - the client loves it, so I have to solve this problem.
16
3009
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 & Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
0
1949
by: Daniel Fetchinson | last post by:
On 4/15/08, Daniel Fetchinson <fetchinson@googlemail.comwrote: BTW, using the following ###################################################################### # CODE TO TEST BOTH FUNCTIONS back = fill_matrix(generate_zero())
0
10452
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5569
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.