Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: is Socket shutdown necessary?



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:
http://lists.apple.com/mailman/options/macnetworkprog/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.