Re: OTSndOrderlyDisconnect
Re: OTSndOrderlyDisconnect
- Subject: Re: OTSndOrderlyDisconnect
- From: Quinn <email@hidden>
- Date: Wed, 9 Jul 2003 09:48:24 +0100
At 22:28 +0200 6/7/03, Roger Persson wrote:
can I call OTSndOrderlyDisconnect when I know my connection will only
receive data and not send any more?
Yes.
Is there any advantages?
There may be, depending on how your client/server model is structure.
If your server supports lots of clients, its better if the clients
call OTSndOrderlyDisconnect (or the BSD sockets equivalent,
shutdown(fd, 1)) rather than the server. This distributes the
FINWAIT (or is that FINWAIT2???) load amongst the clients, rather
than having them all concentrated on the server.
However, the most important thing is that you must conform to the
protocol specification you're using. To wit...
How do other servers understand this? Do they send the request or disconnect
the connection immediately?
That depends on what protocol the servers speak. For example, the
HTTP protocol specifies the following sequence.
1. client opens connection
2. client sends request
3. server sends response
4. server starts disconnect
5. client confirms disconnect
If you're implementing HTTP, you have to follow this sequence.
[It would be a lot nicer to busy HTTP servers if the specification
had required the following sequence.
1. client opens connection
2. client sends request
3. client starts disconnect
4. server sends response
5. server confirms disconnect
However, that's not how it works.]
In summary, from a TCP perspective it's fine if you start a
disconnect after sending all of your data but before receiving all of
the response. If you're designing your own protocol from scratch,
you should probably try to do that. However, if you're implementing
an existing protocol, you have to follow the rules specified by the
protocol.
S+E
--
Quinn "The Eskimo!" <
http://www.apple.com/developer/>
Apple Developer Technical Support * Networking, Communications, Hardware
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.