Re: is Socket shutdown necessary?
Re: is Socket shutdown necessary?
- Subject: Re: is Socket shutdown necessary?
- From: Quinn <email@hidden>
- Date: Wed, 2 Jan 2008 10:14:30 +0000
At 17:19 +0530 27/12/07, parag vibhute wrote:
In msdn, I read that for connectionless protocol(like UDP), socket
SHUTDOWN is not recommended. Is it true?
Yes.
Why?
shutdown can improve matters with connection-oriented protocols. For
example, when using a TCP connection for a simple request/response
protocol, you can shutdown the write side of a socket after sending
the request so that the connection enters the FINWAIT state on the
clients rather than on the server. this reduces the load on the
server by distributing the FINWAIT processing between all of the
clients.
None of this helps for UDP and there's just no reason to call
shutdown on a UDP socket.
At 15:35 +0530 27/12/07, parag vibhute wrote:
My application is using UDP BSD socket for connection. At the end
of communication, I am shutting down socket by using SHUTDOWN API &
then closing it by using CLOSE API. In Panther & Tiger, it is
working fine but in leopard I am getting error that SHUTDOWN is
failed, can somebody tell me what is wrong here?
It situations like this it's helpful if you post the error code. My
guess is that you're getting ENOTCONN (57). Due to UNIX '03
conformance, shutdown is required to return that error if the socket
isn't connected.
S+E
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden