473,761 Members | 4,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

TCPClient Write or BeginWrite (Sync or Async)

First, my question: Should I use Write or BeginWrite (sync or async) to
stream data to my clients.

Details:
On the server I have a custom circular data buffer that receives byte array
data representing data structures at a rate of 30ms.

On a thread seperate from that which Enqueues data to the buffer I have a
high performance timer that Dequeues data from the custom buffer and sends it
via a tcpClient connection to the client. The Dequeue timer runs at a rate
greater than or equal to the Enqueue rate so the buffer never fills up.

On the Client I have a similar custom data buffer that will buffer the data
it receives from the server until it can be displayed.

My data needs to be displayed in the order it was originally created. The
byte array sturctures are < 400 bytes each.

I have googled the internet for hours but I am still not sure if I should be
sending my data to the client using Write or BeginWrite/EndWrite. I know
that with Write I am gauranteed the proper order, which is good, but will
Write be able to keep up performance wise? Or should I use
BeginWrite/EndWrite, then have logic on the client to make sure things are in
the correct order.

Any insight into this is very appreciated!


Nov 17 '05 #1
1 5511
Sorry about the double post, it errored on me the 1st time and I thought it
didn't post.

"Jeff Weber" wrote:
First, my question: Should I use Write or BeginWrite (sync or async) to
stream data to my clients.

Details:
On the server I have a custom circular data buffer that receives byte array
data representing data structures at a rate of 30ms.

On a thread seperate from that which Enqueues data to the buffer I have a
high performance timer that Dequeues data from the custom buffer and sends it
via a tcpClient connection to the client. The Dequeue timer runs at a rate
greater than or equal to the Enqueue rate so the buffer never fills up.

On the Client I have a similar custom data buffer that will buffer the data
it receives from the server until it can be displayed.

My data needs to be displayed in the order it was originally created. The
byte array sturctures are < 400 bytes each.

I have googled the internet for hours but I am still not sure if I should be
sending my data to the client using Write or BeginWrite/EndWrite. I know
that with Write I am gauranteed the proper order, which is good, but will
Write be able to keep up performance wise? Or should I use
BeginWrite/EndWrite, then have logic on the client to make sure things are in
the correct order.

Any insight into this is very appreciated!

Nov 17 '05 #2

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

Similar topics

0
9987
by: Steve - DND | last post by:
We are continually receiving timeout, and "Unable to write data to the transport connection" errors while using the System.Net.HttpWebRequest class from an ASP.Net web page. Below are the two errors we continue to receive: Source: System Message: The operation has timed-out. Target Function: System.Net.WebResponse GetResponse()
3
14547
by: Sagaert Johan | last post by:
Can someone point me to a good implementation of Async Sockets in c# ? So far i did not find a lot usefull info on this item. For the TcpListener, an example that supports multiple incoming connections would be very usefull to get me started. Johan
3
2519
by: Adie | last post by:
I'm using TcpClient in blocking mode with NetworkStreams and would like to be able to give notification that data was sent - I presume this must be possible? But anyone know how?
5
9848
by: Jeff Weber | last post by:
First, my question: Should I use Write or BeginWrite (sync or async) to stream data to my clients over a TCPClient connection. Details: On the server I have a custom circular data buffer that receives byte array data representing data structures at a rate of 30ms. On a thread seperate from that which Enqueues data to the buffer I have a high performance timer that Dequeues data from the custom buffer and sends it via a tcpClient...
1
2426
by: dina_vr | last post by:
Hi All, I am getting lot of System.IO.IOException: Unable to write data to the transport connection. exceptions when I write to a Stream which is connected to a Remote HTTPS server using a proxy and a certificate. ASCIIEncoding encoding = new ASCIIEncoding(); byte data = encoding.GetBytes(..........);
1
1819
by: Chi | last post by:
I am a newibe of C# and async programming thx for your help. I think most likely is my logical problem but i cant figure it out using System.IO; using System.Text; using System; class Class1
7
9704
by: Ole | last post by:
Hi, I'm going to develop a socket communication between an instrument (running CE 5.0 with Compact Fraework V2) and a PC. As the instrument should only connect to one PC at a time I believe that the sync version of the socket should be the easiest - or what??? (please tell if I'm wrong). Are there anyone who is able to point to a Server and Client example code in C# VS2005 (I've only been able to find a C++ version) ???
3
15532
by: Ryan Liu | last post by:
Hi, I use Server: Use an endless thread to lisiten to clients requests: while(true) { TcpClient client = myListener.AcceptTcpClient();
5
4803
by: Nobody | last post by:
Hi all, I try to write a small client that can handle some TCP communication message. I was wondering how I could use the TcpClient class to manage it. At the first time, I don't want to play with the async methods. My main issue is related about receiving informations back from the server. How can I be sure that the server has finished sending the response? Should I set a
0
9522
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10111
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
9948
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9902
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9765
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...
1
7327
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
6603
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();...
1
3866
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
2738
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.