Re: TCPClient Synchronous or Asynchronous Writes
- From: "Dan Bass" <Not Listed>
- Date: Wed, 18 May 2005 08:42:28 +0100
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!
>
>
>
>
.
- Follow-Ups:
- Re: TCPClient Synchronous or Asynchronous Writes
- From: Jeff Weber
- Re: TCPClient Synchronous or Asynchronous Writes
- References:
- TCPClient Synchronous or Asynchronous Writes
- From: Jeff Weber
- TCPClient Synchronous or Asynchronous Writes
- Prev by Date: Re: Uninstall problems with Office PIA
- Next by Date: Re: C# very optimisation
- Previous by thread: TCPClient Synchronous or Asynchronous Writes
- Next by thread: Re: TCPClient Synchronous or Asynchronous Writes
- Index(es):
Relevant Pages
|
Loading