#include <Socket.hh>

Public Types | |
| typedef struct sockaddr_in | ipsock_t |
Public Member Functions | |
| Socket (void) | |
| virtual | ~Socket (void) |
| MsgAddr | getAddr (void) const |
| int | getDebug (void) const |
| MsgAddr | getPartner (void) const |
| int | getRecvBuf (void) const |
| int | getSendBuf (void) const |
| bool | isConnected (void) const |
| bool | isOpen (void) const |
| virtual error_type | async (bool enable=true) |
| virtual error_type | bind (const MsgAddr *addr) |
| virtual error_type | connect (const MsgAddr &addr) |
| virtual error_type | disconnect (void) |
| virtual error_type | read (char *data, size_type len) |
| virtual error_type | receive (Buffer **Data) |
| virtual error_type | receive (Buffer *Data) |
| virtual error_type | send (Buffer *b) |
| virtual error_type | send (const MsgAddr &to, Buffer *b) |
| error_type | wait (wtime_type maxtime) const |
| void | setDebug (int level) |
| void | setPool (BufferPool *pool) |
| void | setPool (SocketPool *pool) |
| error_type | setRecvBuf (int nBytes) |
| error_type | setSendBuf (int nBytes) |
| void | Return (void) |
Static Public Member Functions | |
| static error_type | waitAny (wtime_type maxtime, int N, const Socket *list[]) |
Protected Attributes | |
| MsgAddr | myAddr |
| Address of this socket. | |
| MsgAddr | mPartner |
| Address of partner socket. | |
| BufferPool * | mBPool |
| Pool containing buffers to be used by read(). | |
| bool | mConnected |
| Status bit indicating socket is connected. | |
| int | mSocket |
| Socket file descriptor. | |
typedef struct sockaddr_in lmsg::Socket::ipsock_t [read] |
Import the IP socket address type.
| lmsg::Socket::Socket | ( | void | ) |
Construct an empty socket. brief Construct a socket.
| virtual lmsg::Socket::~Socket | ( | void | ) | [virtual] |
Release the socket and delete all asociated storage. brief Destructor
| MsgAddr lmsg::Socket::getAddr | ( | void | ) | const |
Get the address to which the socket is bound. If the IP-Node portion of the address is zero, it indicates that the same port is allocated on ALL networks known by the node. brief Get socket IP address.
| int lmsg::Socket::getDebug | ( | void | ) | const [inline] |
Get the debug printout level. brief Get debug level.
| MsgAddr lmsg::Socket::getPartner | ( | void | ) | const |
Get the address of the latest communication partner of this socket. If a connection has been made, the partner address will be the address of socket to which it is connected. If no connection has been made, the address specifies the port to which a message was most recently sent or from which a message was most recently received. The IP node portion of the address may be zero if the latest message was sent to or received from the current node. brief Get socket IP address.
| int lmsg::Socket::getRecvBuf | ( | void | ) | const |
Get the system receive buffer length. brief Get the receive buffer length..
| int lmsg::Socket::getSendBuf | ( | void | ) | const |
Get the system send buffer length. brief Get the send buffer length..
| bool lmsg::Socket::isConnected | ( | void | ) | const [inline] |
Test if the socket is connected to a partner. brief Test if socket is connected.
| bool lmsg::Socket::isOpen | ( | void | ) | const [inline] |
Test whether the socket is open. brief Test if socket is open.
| virtual error_type lmsg::Socket::async | ( | bool | enable = true |
) | [virtual] |
Enable or disable asynchronous operation of the socket. If asynchronous operation is enabled, the socket will generate a SIGIO signal each time a message is received for the socket. Note that a SIGIO signal may be generated at any time after asynchronous operation has been enabled, so that SIGIO handling should be specified to the operating system before asynchronous operation is enabled. brief Allow asynchronous message handling.
| virtual error_type lmsg::Socket::bind | ( | const MsgAddr * | addr | ) | [virtual] |
Bind this socket to a specified address. brief Bind socket to an address.
| addr | Address of the socket. |
| virtual error_type lmsg::Socket::connect | ( | const MsgAddr & | addr | ) | [virtual] |
Connect this socket to a specified partner socket. If the connection is successful, the socket patner address is updated. brief connect to a partner address.
| addr | Address of partner to which a connection is to be made. |
| virtual error_type lmsg::Socket::disconnect | ( | void | ) | [virtual] |
Disconnect the socket from a ciurrent parner. If no connection has been made, diconnect returns successfully. brief Disconnect from partner.
Reimplemented in lmsg::TCPSocket.
| virtual error_type lmsg::Socket::read | ( | char * | data, | |
| size_type | len | |||
| ) | [virtual] |
Read data from a socket. brief Receive a message.
| data | Address of data buffer. | |
| len | Number of bytes to read. |
| virtual error_type lmsg::Socket::receive | ( | Buffer ** | Data | ) | [virtual] |
Receive a message from a partner socket. If the socket is connected, the message will be received from the connected partner. If no connection has been made, the message may be received from any port. The socket partner address is updated with the IP address of the port from which the message was received. brief Receive a message.
| Data | Address of pointer in which the address of the buffer containing the received message will be stored. |
| virtual error_type lmsg::Socket::receive | ( | Buffer * | Data | ) | [virtual] |
Receive a message from a partner socket. If the socket is connected, the message will be received from the connected partner. If no connection has been made, the message may be received from any port. The socket partner address is updated with the IP address of the port from which the message was received. brief Receive a message.
| Data | Address of the buffer to receive the message. |
| virtual error_type lmsg::Socket::send | ( | Buffer * | b | ) | [virtual] |
Send a message to a specified partner. brief Send a message.
| b | Buffer containing the message to be sent. |
Send a message to a specified partner. brief Send a message.
| to | Address of port to which the message will be sent. | |
| b | Buffer containing the message to be sent. |
| error_type lmsg::Socket::wait | ( | wtime_type | maxtime | ) | const |
Wait a specified maximum time or until a message is received. Wait can be used to test for an available message by specifying a zero wait time or to wait forever until a message is received by specifying a negative wait time; brief Wait for a message.
| maxtime | Maximum time to wait in seconds. |
| static error_type lmsg::Socket::waitAny | ( | wtime_type | maxtime, | |
| int | N, | |||
| const Socket * | list[] | |||
| ) | [static] |
Wait a specified maximum time or until a message is received by one or more Sockets. Wait can be used to test for an available message by specifying a zero wait time or to wait forever until a message is received by specifying a negative wait time; brief Wait for a message.
| maxtime | Maximum wait time in seconds. | |
| N | Number of socket in the list. | |
| list | List of sockets to be waited on. |
| void lmsg::Socket::setDebug | ( | int | level | ) |
Specify the debug message level. brief Specify a debug level.
| level | of debug messages to be printed. |
| void lmsg::Socket::setPool | ( | BufferPool * | pool | ) |
Specify a buffer pool to be used for received messages. brief Specify a buffer pool.
| pool | Pointer to the buffer pool |
| void lmsg::Socket::setPool | ( | SocketPool * | pool | ) |
Specify a pool of which this socket is to be a member. brief Specify asocket pool.
| pool | Pointer to the socket pool |
| error_type lmsg::Socket::setRecvBuf | ( | int | nBytes | ) |
Specify a system receive buffer size. brief Specify receive buffer length.
| nBytes | Receive buffer length |
| error_type lmsg::Socket::setSendBuf | ( | int | nBytes | ) |
Specify a system send buffer size. brief Specify send buffer length.
| nBytes | Send buffer length |
| void lmsg::Socket::Return | ( | void | ) |
Return the socket to its pool. brief Return Socket to its pool.
1.5.4