An abstract base class for sockets.
More...
#import <ObjectiveLib/Socket.h>
List of all members.
Detailed Description
An abstract base class for sockets.
All the common functionality that all sockets possess is contained in OLSocket.
Member Function Documentation
Return whether this socket allows broadcasting.
This message returns YES if the socket is capable of sending datagrams to a broadcast address.
- See also:
- - setAllowsBroadcast:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- YES if the socket allows broadcasting, NO otherwise
Close the socket.
The socket will no longer be available for communication after receiving this message.
- Exceptions:
-
OLSocketException | if there is an error closing the socket |
Reimplemented in OLUnixServerSocket.
Finalize the socket and deallocate any allocated memory.
Return whether routing is disabled.
If this message returns YES, then outgoing messages will bypass standard routing facilities.
- See also:
- - setDontRoute:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- YES if routing is disabled, NO otherwise
Return whether the platform supports reusing ports.
This information can also be gleaned at compile time by checking whether OL_HAVE_SO_REUSEPORT is defined. If this message returns YES, then the messages reusePort and setReusePort: can meaningfully be used.
If this messages returns YES then more than one socket can be bound to the same port and all broadcast datagrams will be received by all sockets sharing the port.
- See also:
- - reusePort, - setReusePort:
- Returns:
- YES if the platform support reusing ports, NO otherwise
Return the in stream associated with the socket.
The in stream can be used to read data written by the socket connected to this one. The in stream returned is guaranteed to live as long as the socket does. If you attempt to retain and use the in stream after releasing the socket, you'll discover that it doesn't work.
- See also:
- outStream
- Returns:
- the socket's in stream
Return whether "keep alive" is enabled.
If this message returns YES, then the socket will periodically send messages to its peer in order to make sure the connection remains active.
- See also:
- - setKeepAlive:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- YES if "keep alive" is enabled, NO otherwise
Return the number of seconds to linger.
If a linger interval is set, then the socket will block when close is called for the given number seconds while there is data remaining for the socket to transmit. If no linger interval is set, then this message return UINT_MAX. Also, if linger is set to zero, then close will not block, and pending data will be discarded. If linger is not enabled, then close will not block, but pending data will be sent anyway.
- See also:
- - setLinger:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- the number of seconds to linger or UINT_MAX if linger is not enabled
Return the local address.
The local address is the address to which this socket is bound.
- See also:
- - remoteAddress
- Exceptions:
-
OLSocketException | if the socket is not bound to a local address |
- Returns:
- the local address
Reimplemented in OLUnixServerSocket.
Return whether out-of-band data is received inline.
When this message returns YES then all out-of-band data received on the socket will be mixed in with the normal data transmitted to the socket by its peer.
- See also:
- - setOutOfBandInline:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- YES if out-of-band data is received inline, NO otherwise
Return the out stream associated with the socket.
The out stream can be used to write data that can be read by the socket's peer. The out stream returned is guaranteed to live as long as the socket does. If you attempt to retain and use the stream after releasing the socket, you'll discover that it doesn't work.
- See also:
- inStream
- Returns:
- the socket's out stream
Return the size of the buffer for received data.
The system maintains a buffer for receiving data. This message tells you its size.
- See also:
- - setReceiveBufferSize:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- the size of the buffer for received data
Return the low-water mark for receiving data.
The low-water mark refers to the minimum number of bytes for input operations.
- See also:
- - setReceiveLowWaterMark:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- the minimum number of bytes for input
Return the time out for receiving data.
This value is the maximum amount of time in milliseconds that the socket will wait to receive requested data.
- See also:
- - setReceiveTimeOut:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- the number of milliseconds to wait to receive data
Return the address of the socket's peer.
The remote address is the one to which this socket is connected.
- See also:
- - localAddress
- Exceptions:
-
OLSocketException | if there is a problem retrieving the address |
- Returns:
- the remote address
Return whether reusing of addresses is enabled.
If this message returns YES, then this socket may be bound to an address that is in a time out state.
- See also:
- - setReuseAddress:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- YES if this socket can reuse an address, NO otherwise
Return whether this socket can reuse a port.
If this message returns YES, then this socket can be bound to a port already in use by another socket for the purposes of receiving broadcast datagrams.
- Note:
- If the message hasReusePortSupport returns NO, then this message always returns NO.
- See also:
- - setReusePort:, - hasReusePortSupport
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- YES if this socket can reuse ports, NO otherwise
Return the size of the buffer for sent data.
The system maintains a buffer for sending data. This message tells you its size.
- See also:
- - setSendBufferSize:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- the size of the buffer for sent data
Return the low-water mark for sending data.
The low-water mark refers to the minimum number of bytes for output operations.
- See also:
- - setSendLowWaterMark:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- the minimum number of bytes for output
Return the time out for sending data.
This value is the maximum amount of time in milliseconds that the socket will wait to send data.
- See also:
- - setSendTimeOut:
- Exceptions:
-
OLSocketException | if there is an error retrieving the information |
- Returns:
- the number of milliseconds to wait to send data
Set whether this socket allows broadcasting.
Set state to YES if the socket should be capable of sending datagrams to a broadcast address.
- See also:
- - allowsBroadcast
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
state | YES if the socket should allow broadcast, NO if not |
Set whether routing is disabled.
Set state to YES if outgoing messages should bypass standard routing facilities.
- See also:
- - dontRoute
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
state | YES if routing should be disabled, NO if not |
Set whether "keep alive" is enabled.
Set state to YES if the socket should periodically send messages to its peer in order to make sure the connection remains active.
- See also:
- - keepAlive
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
state | YES if keep alive should be enabled, NO if not |
Set the number of seconds to linger.
If a linger interval is set, then the socket will block when close is called for the given number seconds while there is data remaining for the socket to transmit. If linger is set to zero, then close will not block, and pending data will be discarded. If linger is not enabled, then close will not block, but pending data will be sent anyway.
To disable lingering value should be set to UINT_MAX.
- See also:
- - linger
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
value | the number of seconds to linger or UINT_MAX if lingering should be disabled |
Set whether out-of-band data is received inline.
Set state to YES to make all out-of-band data received on the socket to be mixed in with the normal data transmitted to the socket by its peer.
- See also:
- - outOfBandInline
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
state | YES if out-of-band data should be received inline, NO if not |
Set the size of the buffer for receiving data.
- See also:
- - receiveBufferSize
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
size | the new size of the receive buffer |
Set the low-water mark for receiving data.
The low-water mark refers to the minimum number of bytes for input operations.
- See also:
- - receiveLowWaterMark
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
value | the minimum number of bytes for input |
Set the time out for receiving data.
This value is the maximum amount of time in milliseconds that the socket will wait to receive requested data.
- See also:
- - receiveTimeOut
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
value | the number of milliseconds to wait to receive data |
Set whether reusing of addresses is enabled.
Set state to YES to enable this socket to be bound to an address that is in a time out state.
- See also:
- - reuseAddress
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
state | YES if this socket should be able to reuse an address, NO if not |
Set whether this socket can reuse a port.
Set state to YES so that this socket can be bound to a port already in use by another socket for the purposes of receiving broadcast datagrams.
- Note:
- If the message hasReusePortSupport returns NO, then this message has no effect.
- See also:
- - reusePort, - hasReusePortSupport
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
state | YES if this socket should be able to reuse ports, NO if not |
Set the size of the buffer for sending data.
- See also:
- - sendBufferSize
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
size | the new size of the send buffer |
Set the low-water mark for sending data.
The low-water mark refers to the minimum number of bytes for output operations.
- See also:
- - sendLowWaterMark
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
value | the minimum number of bytes for output |
Set the time out for sending data.
This value is the maximum amount of time in milliseconds that the socket will wait to send data.
- See also:
- - sendTimeOut
- Exceptions:
-
OLSocketException | if there is an error setting the information |
- Parameters:
-
value | the number of milliseconds to wait to send data |
Disallow incoming data to be received.
After sending this message it will be impossible to read any more data from the socket.
- Exceptions:
-
OLSocketException | if there was a problem shutting down the socket |
Disallow outgoing data to be sent.
After sending this message it will be impossible to send any more data to the socket.
- Exceptions:
-
OLSocketException | if there was a problem shutting down the socket |
Return the type of socket.
The value returned is a platform-dependent number that represents the type of the socket. This number will correspond to a defined value such as SOCK_STREAM or SOCK_DGRAM.
- Exceptions:
-
OLSocketException | if there was a problem retrieving the information |
- Returns:
- the type of the socket
Member Data Documentation
The file descriptor associated with the socket.
The documentation for this class was generated from the following file: