Re: TCP_NODELAY
- From: "m" <m@xxx>
- Date: Fri, 19 Sep 2008 17:09:43 -0400
Using TCP as a catch all protocol is a bad idea. UDP is not the only other
option either, but happens to be easy to work with from UM in windows.
In your example of an online game, a better solution would be a TCP control
channel + UDP 'action' messages.
It is irreverent to presume that one knows more than the designers of TCP
but dogmatic to assume that they know more that everyone else - especially
since they designed a general purpose protocol and not all purposes are
general!
"Chris Becke" <chris.becke@xxxxxxxxx> wrote in message
news:uQnpRCjGJHA.2408@xxxxxxxxxxxxxxxxxxxxxxx
One could use UDP. and wrap it in a protocol that robustly deals with
dropped packets.
One could re-invent the wheel.
Or, one could just use TCP: Which already deals with dropped packets. And,
usually does so far more robustly than any homegrown solution.
I have yet to see a good example of a UDP based protocol that outperforms
TCP. Only good examples of bad programmers thinking they know more than the
designers of TCP.
"Alun Jones" <alun@xxxxxxxxxxxxx> wrote in message
news:exXs48gGJHA.2580@xxxxxxxxxxxxxxxxxxxxxxx
"Chris Becke" <chris.becke@xxxxxxxxx> wrote in message
news:Oyfso8WGJHA.3664@xxxxxxxxxxxxxxxxxxxxxxx
The first thing you MUST do when setting TCP_NODELAY is wrap all your
sends up as much as possible into a single call to send.
Thereafter however, there is much performance to be gained in particular
application domains by setting TCP_NODELAY. Assuming you are sending less
than ~20Kb per second.
If, for example, you are writing any kind of online game, having the
socket layers hold onto packets for 200ms is unacceptable. Ignoring
actual
network latencies you now have a ~400ms round trip latency on all comms.
Which is now larger than a humans reaction time.
If, for example, you are writing any kind of online game, you don't want
to
be using TCP, because it can _always_ introduce latency (noise on the line
causing a retransmission is just one way to introduce latency). If you
don't
want occasional latency, you must use UDP - and your protocol must
robustly
deal with dropped packets.
I have yet to see a _good_ example of the use of TCP_NODELAY - only good
examples of bad programmers, or good examples of programmers having to
deal
with bad protocol design.
.
- References:
- TCP_NODELAY
- From: none
- Re: TCP_NODELAY
- From: Alun Jones
- Re: TCP_NODELAY
- From: Chris Becke
- Re: TCP_NODELAY
- From: Alun Jones
- Re: TCP_NODELAY
- From: Chris Becke
- TCP_NODELAY
- Prev by Date: Re: TCP_NODELAY
- Next by Date: Re: Determine non-wireless network cards
- Previous by thread: Re: TCP_NODELAY
- Next by thread: Re: TCP_NODELAY
- Index(es):
Relevant Pages
|
Loading