#import <ObjectiveLib/Socket.h>
Inheritance diagram for OLSocket:
Public Member Functions | |
(BOOL) | - allowsBroadcast |
Return whether this socket allows broadcasting. | |
(void) | - close |
Close the socket. | |
(BOOL) | - dontRoute |
Return whether routing is disabled. | |
(BOOL) | - hasReusePortSupport |
Return whether the platform supports reusing ports. | |
(OLInStream *) | - inStream |
Return the in stream associated with the socket. | |
(BOOL) | - keepAlive |
Return whether "keep alive" is enabled. | |
(unsigned) | - linger |
Return the number of seconds to linger. | |
(OLSocketAddress *) | - localAddress |
Return the local address. | |
(BOOL) | - outOfBandInline |
Return whether out-of-band data is received inline. | |
(OLOutStream *) | - outStream |
Return the out stream associated with the socket. | |
(unsigned) | - receiveBufferSize |
Return the size of the buffer for received data. | |
(unsigned) | - receiveLowWaterMark |
Return the low-water mark for receiving data. | |
(unsigned) | - receiveTimeOut |
Return the time out for receiving data. | |
(OLSocketAddress *) | - remoteAddress |
Return the address of the socket's peer. | |
(BOOL) | - reuseAddress |
Return whether reusing of addresses is enabled. | |
(BOOL) | - reusePort |
Return whether this socket can reuse a port. | |
(unsigned) | - sendBufferSize |
Return the size of the buffer for sent data. | |
(unsigned) | - sendLowWaterMark |
Return the low-water mark for sending data. | |
(unsigned) | - sendTimeOut |
Return the time out for sending data. | |
(void) | - setAllowsBroadcast: |
Set whether this socket allows broadcasting. | |
(void) | - setDontRoute: |
Set whether routing is disabled. | |
(void) | - setKeepAlive: |
Set whether "keep alive" is enabled. | |
(void) | - setLinger: |
Set the number of seconds to linger. | |
(void) | - setOutOfBandInline: |
Set whether out-of-band data is received inline. | |
(void) | - setReceiveBufferSize: |
Set the size of the buffer for receiving data. | |
(void) | - setReceiveLowWaterMark: |
Set the low-water mark for receiving data. | |
(void) | - setReceiveTimeOut: |
Set the time out for receiving data. | |
(void) | - setReuseAddress: |
Set whether reusing of addresses is enabled. | |
(void) | - setReusePort: |
Set whether this socket can reuse a port. | |
(void) | - setSendBufferSize: |
Set the size of the buffer for sending data. | |
(void) | - setSendLowWaterMark: |
Set the low-water mark for sending data. | |
(void) | - setSendTimeOut: |
Set the time out for sending data. | |
(void) | - shutdownRead |
Disallow incoming data to be received. | |
(void) | - shutdownWrite |
Disallow outgoing data to be sent. | |
(int) | - socketType |
Return the type of socket. | |
Initializers and Deallocators | |
(id) | - free |
Finalize the socket and deallocate any allocated memory. | |
Protected Attributes | |
int | fd |
The file descriptor associated with the socket. | |
OLInStream * | inStream |
The socket's in stream. | |
OLOutStream * | outStream |
The socket's out stream. |
All the common functionality that all sockets possess is contained in OLSocket.
- (BOOL) allowsBroadcast |
Return whether this socket allows broadcasting.
This message returns YES if the socket is capable of sending datagrams to a broadcast address.
OLSocketException | if there is an error retrieving the information |
- (void) close |
Close the socket.
The socket will no longer be available for communication after receiving this message.
OLSocketException | if there is an error closing the socket |
Reimplemented in OLUnixServerSocket.
- (BOOL) dontRoute |
Return whether routing is disabled.
If this message returns YES, then outgoing messages will bypass standard routing facilities.
OLSocketException | if there is an error retrieving the information |
- (id) free |
Finalize the socket and deallocate any allocated memory.
- (BOOL) hasReusePortSupport |
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.
- (OLInStream*) inStream |
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.
- (BOOL) keepAlive |
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.
OLSocketException | if there is an error retrieving the information |
- (unsigned) linger |
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.
OLSocketException | if there is an error retrieving the information |
- (OLSocketAddress*) localAddress |
Return the local address.
The local address is the address to which this socket is bound.
OLSocketException | if the socket is not bound to a local address |
Reimplemented in OLUnixServerSocket.
- (BOOL) outOfBandInline |
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.
OLSocketException | if there is an error retrieving the information |
- (OLOutStream*) outStream |
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.
- (unsigned) receiveBufferSize |
Return the size of the buffer for received data.
The system maintains a buffer for receiving data. This message tells you its size.
OLSocketException | if there is an error retrieving the information |
- (unsigned) receiveLowWaterMark |
Return the low-water mark for receiving data.
The low-water mark refers to the minimum number of bytes for input operations.
OLSocketException | if there is an error retrieving the information |
- (unsigned) receiveTimeOut |
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.
OLSocketException | if there is an error retrieving the information |
- (OLSocketAddress*) remoteAddress |
Return the address of the socket's peer.
The remote address is the one to which this socket is connected.
OLSocketException | if there is a problem retrieving the address |
- (BOOL) reuseAddress |
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.
OLSocketException | if there is an error retrieving the information |
- (BOOL) reusePort |
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.
OLSocketException | if there is an error retrieving the information |
- (unsigned) sendBufferSize |
Return the size of the buffer for sent data.
The system maintains a buffer for sending data. This message tells you its size.
OLSocketException | if there is an error retrieving the information |
- (unsigned) sendLowWaterMark |
Return the low-water mark for sending data.
The low-water mark refers to the minimum number of bytes for output operations.
OLSocketException | if there is an error retrieving the information |
- (unsigned) sendTimeOut |
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.
OLSocketException | if there is an error retrieving the information |
- (void) setAllowsBroadcast: | (BOOL) | state |
Set whether this socket allows broadcasting.
Set state to YES if the socket should be capable of sending datagrams to a broadcast address.
OLSocketException | if there is an error setting the information |
state | YES if the socket should allow broadcast, NO if not |
- (void) setDontRoute: | (BOOL) | state |
Set whether routing is disabled.
Set state to YES if outgoing messages should bypass standard routing facilities.
OLSocketException | if there is an error setting the information |
state | YES if routing should be disabled, NO if not |
- (void) setKeepAlive: | (BOOL) | state |
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.
OLSocketException | if there is an error setting the information |
state | YES if keep alive should be enabled, NO if not |
- (void) setLinger: | (unsigned) | value |
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.
OLSocketException | if there is an error setting the information |
value | the number of seconds to linger or UINT_MAX if lingering should be disabled |
- (void) setOutOfBandInline: | (BOOL) | state |
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.
OLSocketException | if there is an error setting the information |
state | YES if out-of-band data should be received inline, NO if not |
- (void) setReceiveBufferSize: | (unsigned) | size |
Set the size of the buffer for receiving data.
OLSocketException | if there is an error setting the information |
size | the new size of the receive buffer |
- (void) setReceiveLowWaterMark: | (unsigned) | value |
Set the low-water mark for receiving data.
The low-water mark refers to the minimum number of bytes for input operations.
OLSocketException | if there is an error setting the information |
value | the minimum number of bytes for input |
- (void) setReceiveTimeOut: | (unsigned) | value |
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.
OLSocketException | if there is an error setting the information |
value | the number of milliseconds to wait to receive data |
- (void) setReuseAddress: | (BOOL) | state |
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.
OLSocketException | if there is an error setting the information |
state | YES if this socket should be able to reuse an address, NO if not |
- (void) setReusePort: | (BOOL) | state |
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.
OLSocketException | if there is an error setting the information |
state | YES if this socket should be able to reuse ports, NO if not |
- (void) setSendBufferSize: | (unsigned) | size |
Set the size of the buffer for sending data.
OLSocketException | if there is an error setting the information |
size | the new size of the send buffer |
- (void) setSendLowWaterMark: | (unsigned) | value |
Set the low-water mark for sending data.
The low-water mark refers to the minimum number of bytes for output operations.
OLSocketException | if there is an error setting the information |
value | the minimum number of bytes for output |
- (void) setSendTimeOut: | (unsigned) | value |
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.
OLSocketException | if there is an error setting the information |
value | the number of milliseconds to wait to send data |
- (void) shutdownRead |
Disallow incoming data to be received.
After sending this message it will be impossible to read any more data from the socket.
OLSocketException | if there was a problem shutting down the socket |
- (void) shutdownWrite |
Disallow outgoing data to be sent.
After sending this message it will be impossible to send any more data to the socket.
OLSocketException | if there was a problem shutting down the socket |
- (int) socketType |
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.
OLSocketException | if there was a problem retrieving the information |
- (int) fd [protected] |
The file descriptor associated with the socket.
- (OLInStream*) inStream [protected] |
The socket's in stream.
- (OLOutStream*) outStream [protected] |
The socket's out stream.
|