Re: TCPClient Synchronous or Asynchronous Writes



Dan, thanks for the response.

Here are the details of my situation.

There are 5 computers sitting around a manufacturing machine. The computers
are connected by a fairly high speed closed network. One of the 5 computers
acting as the "server" receives quality assurance data from different
measurement devices situated around the machine. The max rate that the
machine can send this measurement data to the server is ~30ms. The data
comes into the Server as byte arrays representing various data structures.

The goal is to get this data out to each of the 4 clients so that it can be
displayed graphically to the machine operators. The data has to arrive as
close to real time as possible (it can lag a little) and it has to be in
order.

Currently, as the data comes into the server it is immediatly Enqueued into
a Circular Buffer. Each client can register to look at differnt data so there
is actually a Circular Buffer for each client. A seperate thread running on
a high performance timer constantly pulls (Dequeues) items from the Buffers
and sends them (via tcp/ip) to each client.

Once the client receives a data item, it throws that item into a client side
Circular Buffer. Another thread on the client, again running on a timer,
pulls items from this buffer and displays the data.

FYI, each data structure is ~200-300 bytes.

I'd be interested in hearing other solutions. For now, I think I will look
into possible sending items from client to server in groups rather than one
at a time. Is it your opinion this would improve my performance, since my
send rate would be lower. (even though the size of the data being sent would
be larger.)

"Dan Bass" wrote:

>
> Generally, if order is that important you should stick with synchronous. If
> you go the asynchronous route, there's no guarantee the first packet of data
> will arrive before the second... In my thinking you'd only use the
> multithreading option if sending to multiple clients.
>
> Hitting TCP this often and hard wouldn't be desirable for any network.
> Because the rate is so high, is there an option of buffer up your data and
> post it off to the client every few seconds in one block. The client would
> then separate the data into sub-blocks it needs again. There'd also be
> facility here then to handle things like dropped connections, where the data
> that is ready to send gets buffered up until the connection is
> re-established.
>
> Out of curiosity, what the scenario surrounding these few stages? Perhaps
> there are other ways of doing what you are trying to accomplish.
>
> Good luck.
> Dan.
>
> "Jeff Weber" <Jeff Weber@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:020BA73A-692C-43AF-BF17-FB5021DA7A0B@xxxxxxxxxxxxxxxx
> > 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 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.
> >
> > 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!
> >
> >
> >
> >
>
>
>
.



Relevant Pages

  • Re: .Net Scalability problem
    ... LoadRunner will peak out a server with a few virtual users. ... To get an idea of load, ... Fire off the test client and watch the number of ... > So I think that the MTC generate concurrent connection and per ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Connection lost at same time every hour (sometimes)
    ... After making the two following alterations on the server the problem seems ... After analyze your ipconfig on SBS and client, ... Then, other connection is good, ...
    (microsoft.public.windows.server.sbs)
  • Re: server disconnection - very often
    ... Reason of permanent popups is VMware server aplication on clients. ... Run CEICW to configure the network of SBS: ... Two network adapters - manual router connection to broadband ... Uninstall VMware on client. ...
    (microsoft.public.windows.server.sbs)
  • Re: Lan setup 2 nic
    ... The external nic only has TCP/IP enabled. ... Ipconfig of the server is looking good, but the client is still missing the ... > connection so we have a 2 nic with router setup now. ...
    (microsoft.public.windows.server.sbs)
  • Re: Regular disconnections from remote web workplace
    ... I can connect to office server and all office clients from home at all times ... be physically working right up until the connection is lost. ... If I enter http://companyip from a client I receive the login screen for the ... Click Services tab and select Hide All Microsoft Services and Disable ...
    (microsoft.public.windows.server.sbs)