Re: about socket with tci/ip
From: Alun Jones [MSFT] (alunj_at_online.microsoft.com)
Date: 10/06/04
- Next message: Eugene Gershnik: "Re: What is the fastest way to transfer files between two machines"
- Previous message: Alun Jones [MSFT]: "Re: What is the fastest way to transfer files between two machines"
- In reply to: manu: "about socket with tci/ip"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 6 Oct 2004 11:34:53 -0700
"manu" <manu@manu.net> wrote in message
news:OIX#t96qEHA.516@TK2MSFTNGP09.phx.gbl...
> I have a server app on a computer and some clients onto others computers
> (classical).
>
> The clients and the server ask every 10 secondes, if the other is alive.
> Sometimes, there is a time out: the response never come. All responses
come
> back very quickly, less than one seconde. Even if i wait 60 secondes.
>
> What is the reason ?
What is the reason for ...?
The reason for responses coming back very quickly is that TCP/IP is
reasonably responsive under most conditions.
The reasons that a timeout might happen are many and varied, but generally
boil down to an inability to route packets to / from your peer. An
unplugged or severed cable is a good example of the sort of thing that might
cause this error; also a dead or misconfigured router in between you would
do this, as would a crash at the peer.
> - Too much clients ?
No - once you have a socket, while it's possible that new incoming /outgoing
connections may be refused due to lack of memory, that socket will still
operate. The most it will do is run slowly.
> - CPU is overloaded ?
Again, this just slows you down. TCP retransmits to keep reliability.
> - because of hardware ? (switchs, hubs,...)
Yes. Any time that there is a physical disconnect, and packets can't make
it to or from the peers in a connection, you'll see no network traffic as
long as the disconnect continues.
> - bad programmation ?
Yes - that's always a factor. There's so much awful networking software out
there, written by people who haven't studied books on networking before they
wrote their applications, that there's always a good chance that the program
connecting to you is badly written. Even good software has occasional bugs
in, and will lead to unexpected behaviour.
I often describe network programming as the challenge of writing half of a
program, where the other half of the program is not only not written by you,
but may even have been written by someone who hates you enough to try and
destroy your half of the program. You have to learn to write code that will
cooperate with 'good code' and act appropriately in response to 'bad code'.
> Is a tcp/ip packet can be loosen ?
Sure - reliability only goes so far. TCP guarantees reliability in that any
stream (there are two in each connection) that proceeds from SYN to FIN will
contain all the data that was put into the stream, in the same order it was
put in. [Obviously, if someone in the middle corrupts the stream, that's a
different matter.] But once a piece of data has been put into your sending
buffer, it has endless opportunities to get lost before it reaches its
destination. That's why you need timeouts - to cope with the situation that
there is no more route between the two peers, and data has stopped
traveling.
> (in this case is it valid to say that it's the reason ?)
Just say that no data was detected during the specified timeout period, and
that you will be disconnecting the client as a result. That's all. Don't
try and guess what you cannot know.
Alun.
~~~~
- Next message: Eugene Gershnik: "Re: What is the fastest way to transfer files between two machines"
- Previous message: Alun Jones [MSFT]: "Re: What is the fastest way to transfer files between two machines"
- In reply to: manu: "about socket with tci/ip"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|