#include <TCPSocket.hpp>
Collaboration diagram for Ionflux::Tools::TCPSocket:

Public Member Functions | |
| TCPSocket () | |
| Constructor. | |
| TCPSocket (int initPort) | |
| Constructor. | |
| TCPSocket (const std::string &initHost, int initPort) | |
| Constructor. | |
| virtual | ~TCPSocket () |
| Destructor. | |
| virtual bool | resolve () |
| Resolve remote hostname. | |
| virtual bool | connect () |
| Connect. | |
| virtual void | close () |
| Close connection. | |
| virtual bool | bind () |
| Bind socket. | |
| virtual bool | bind (unsigned int newAddress) |
| Bind socket. | |
| virtual bool | listen () |
| Listen. | |
| virtual int | accept (sockaddr_in &newAddr, socklen_t &newAddrSize) |
| Accept connection. | |
| virtual bool | accept (TCPSocket &newClientSocket) |
| Accept connection. | |
| virtual bool | readBytes (std::string &bytes) |
| Read bytes. | |
| virtual bool | sendBytes (const std::string &bytes) |
| Send bytes. | |
| virtual void | setRemoteHost (const std::string &newHost) |
| Set remote host. | |
| virtual void | setPort (int newPort) |
| Set port. | |
| virtual void | setListenQueue (int newListenQueue) |
| Set listen queue. | |
| virtual void | setFD (int newFD) |
| Set file descriptor. | |
| virtual void | setConnectionState (bool newConnectionState) |
| Set connection state. | |
| virtual void | setBindingState (bool newBindingState) |
| Set binding state. | |
| virtual void | setListeningState (bool newListeningState) |
| Set listening state. | |
| virtual void | setClientIP (const std::string &newClientIP) |
| Set client IP. | |
| virtual int | getPort () |
| Get port. | |
| virtual std::string | getRemoteHost () |
| Get remote host. | |
| virtual int | getFD () |
| Get file descriptor. | |
| virtual bool | isConnected () |
| Connection state. | |
| virtual int | getListenQueue () |
| Get listen queue. | |
| virtual bool | isBound () |
| Binding state. | |
| virtual bool | isListening () |
| Listening state. | |
| virtual std::string | getClientIP () |
| Get client IP. | |
| virtual Reporter & | getLog () |
| Get Console output/logging facility. | |
Static Public Attributes | |
| static const int | READ_BUFFER_SIZE = 1024 |
| Size of read buffer. | |
| static const int | DEFAULT_LISTEN_QUEUE = 10 |
| Default queue size for incoming connections. | |
Protected Attributes | |
| Ionflux::Tools::Reporter | log |
| Console output/logging. | |
| std::string | remoteHostName |
| Remote hostname. | |
| std::string | clientIP |
| Client IP address. | |
| int | port |
| Remote port number. | |
| int | theSocket |
| Socket file descriptor. | |
| bool | connected |
| Connection state. | |
| bool | bound |
| Binding state. | |
| bool | listening |
| Listening state. | |
| sockaddr_in | remoteHostAddress |
| Address of the remote socket. | |
| sockaddr_in | localHostAddress |
| Address of the local socket. | |
| hostent * | remoteHostEntry |
| Host entry of the remote host. | |
| int | listenQueue |
| Queue size for incoming connections. | |
Wrapper class for a TCP socket.
|
|
Constructor. Construct a new TCPSocket object. |
|
|
Constructor. Construct a new TCPSocket object.
|
|
||||||||||||
|
Constructor. Construct a new TCPSocket object.
|
|
|
Destructor. Destruct TCPSocket object. |
|
|
Accept connection.
Accepts a new client connection on a listening socket and initializes a TCPSocket object appropriately. Returns
|
|
||||||||||||
|
Accept connection. Accepts a new client connection on a listening socket.
|
|
|
Bind socket.
Bind a socket to a local port and interface. Pass INADDR_ANY to 'address' to bind to all available local interfaces. Returns
|
|
|
Bind socket. Bind a socket to a local port on all available local interfaces.
|
|
|
Close connection. Closes the connection. |
|
|
Connect. Connect to remote host.
|
|
|
Get client IP. Get the IP address which the socket is bound to.
|
|
|
Get file descriptor. Get the file descriptor associated with this socket object.
|
|
|
Get listen queue. Get the listen queue size for a server socket.
|
|
|
Get Console output/logging facility.
|
|
|
Get port. Get the port number this socket object will connect to.
|
|
|
Get remote host. Get the hostname of the remote host this socket object will connect to.
|
|
|
Binding state. Get the binding state of the socket.
|
|
|
Connection state. Get the connection state.
|
|
|
Listening state. Get the listening state of the socket.
|
|
|
Listen. Listen for incoming connections.
|
|
|
Read bytes. Read bytes from the socket.
|
|
|
Resolve remote hostname. Resolve the remote hostname.
|
|
|
Send bytes. Send bytes over the socket.
|
|
|
Set binding state. Sets the binding state.
|
|
|
Set client IP. Sets the IP address of the client represented by this TCPSocket object.
|
|
|
Set connection state. Sets the connection state.
|
|
|
Set file descriptor. Sets the file descriptor associated with this socket object.
|
|
|
Set listening state. Sets the listening state.
|
|
|
Set listen queue. Sets the size of the queue for incoming connections.
|
|
|
Set port. Sets the port this socket object will connect to.
|
|
|
Set remote host. Sets the remote host this socket object will connect to. You can specify either a host name or an IP address.
|
|
|
Binding state.
|
|
|
Client IP address. This is used by accept() to store the IP address of a connected client. |
|
|
Connection state.
|
|
|
Default queue size for incoming connections.
|
|
|
Listening state.
|
|
|
Queue size for incoming connections.
|
|
|
Address of the local socket.
|
|
|
Console output/logging.
|
|
|
Remote port number.
|
|
|
Size of read buffer.
|
|
|
Address of the remote socket.
|
|
|
Host entry of the remote host.
|
|
|
Remote hostname.
|
|
|
Socket file descriptor.
|
1.4.6