- Inherits From:
- Declared In:
Note that some (IP) socket related functionality is implemented in a category on NSFileHandle.
Description:Name of an exception which occurs when the connection to a remote port fails due to a timeout.
Description:Name of an exception which occurs when the connection to a remote port is refused.
struct _EDIPSFlags flags;
flags All instance variables are private.
Setting socket options
Set local endpoint
- - setAllowsTransmittingBroadcastMessages:
- - setAllowsAddressReuse:
- - setAllowsPortReuse:
- - setSendTimeout:
- - setReceiveTimeout:
Set remote endpoint
- - setLocalPort:
- - setLocalPort:andAddress:
- - connectToHost:port:
- - connectToAddress:port:
- - isConnected
- (void)connectToAddress:(NSString *)addressString port:(unsigned short)port
Attempts to connect the remote endpoint of the socket to port on the host with the IP address described by addressString; the latter being in the "typical" dotted numerical notation.
- (void)connectToHost:(NSHost *)host port:(unsigned short)port
Attempts to connect the remote endpoint of the socket to port on host.
Returns YES if the socket allows communication, either in both directions or only sending or receiving; the latter resulting from shutdownInput or shutdownOutput invocations. (These are implemented in a category on NSFileHandle.) It only returns NO if the socket is completely disconnected.
Controls how quickly an address/port combination can be re-used. With this option set a socket can be connected to a port that is still in
TIME_WAIT state which is useful if your server has been shut down, and then restarted right away while sockets are still active on its port. You should be aware that if any unexpected data comes in, it may confuse your server, but while this is possible, it is not likely. This corresponds to
Controls whether the address/port combination can be shared by multiple sockets. Note that all sockets sharing the address/port must have this option set for it to work. This corresponds
SO_REUSEPORT and is currently only implemented on Apple platforms even though other BSD and BSD-derived systems should support it. Note that for multicast addresses this is considered synonymous to
SO_REUSEADDR ("TCP/IP Illustrated, Volume 2", p. 731.) So, for portability of multicasting applications you should use setAllowsAddressReuse: instead.
Controls whether broadcast messages are allowed. This corresponds to
- (void)setLocalPort:(unsigned short)port
Binds the local endpoint of the socket to aPort on all local IP addresses (interfaces).
- (void)setLocalPort:(unsigned short)port andAddress:(NSString *)addressString
Binds the local endpoint of the socket to aPort on the local IP address described by addressString; the latter being in the "typical" dotted numerical notation.
Sets the timeout for receive (read) operations to aTimeoutVal. This corresponds to
Sets the timeout for send (write) operations to aTimeoutVal. This corresponds to