#include <core_socket.h>

Public Member Functions | |
| CoreSocket () | |
| The default constructor. | |
| CoreSocket (socket_t socket) | |
| The constructor for an existing socket. | |
| virtual | ~CoreSocket () |
| The destructor. | |
| virtual int | Close () |
| Close the socket. | |
| virtual int | GetError () const |
| Get the error value for the socket. | |
| u_long | GetRemoteHost () |
| Fetches the IP address of the remote host. | |
| const char * | GetRemoteIP () |
| Fetches the IP address of the remote host. | |
| u_long | GetLocalHost () |
| Fetches the IP address of the remote host. | |
| const char * | GetLocalIP () |
| Fetches the IP address of the remote host. | |
| socket_t | GetSocket () |
| Gives access to the socket itself (for extensibility only). | |
| virtual bool | IsReadable () const |
| Determines whether the socket is ready for a Read operation. | |
| virtual bool | IsWritable () const |
| Determines whether the socket is ready for a Read operation. | |
| virtual socketState | State () const |
| Fetch the state of the socket. | |
| virtual int | Listen (unsigned short _port)=0 |
| Opens the port specified to listen for incoming connections. | |
| virtual int | Read (char *_output, unsigned int *_len) |
| Reads a block of data with a specified maximum size. | |
| virtual int | Read (std::string &_output) |
| Reads a block of data with a specified maximum size. | |
| virtual int | Send (const void *_data, size_t _length) |
| Sends a block of data. | |
| virtual int | Send (std::string _data) |
| Sends a string. | |
Protected Member Functions | |
| virtual int | SetAttributes (socket_t _socket)=0 |
| Sets some important attributes on the socket. | |
Protected Attributes | |
| int | m_bufferSize |
| The maximum number of bytes to read per CoreSocket::Read or CoreSocket::ReadLine call. | |
| char | m_calledInitialise |
| Indicates whether __socket_initialise() was called when the class was initialized. | |
| socket_t | m_sock |
| Stores the socket data. | |
| socketProtocol | m_proto |
| Indicates the protocol used by this socket instance. | |
| socketState | m_state |
| Indicates the current state of m_sock. | |
Abstract class only. Must be inherited.
| virtual int Close | ( | ) | [virtual] |
Close the socket.
Doesn't need to be called before an instance is destructed, because it is automatically called in the destructor.
| virtual int GetError | ( | ) | const [virtual] |
Get the error value for the socket.
| u_long GetLocalHost | ( | ) |
Fetches the IP address of the remote host.
| const char* GetLocalIP | ( | ) |
Fetches the IP address of the remote host.
| u_long GetRemoteHost | ( | ) |
Fetches the IP address of the remote host.
| const char* GetRemoteIP | ( | ) |
Fetches the IP address of the remote host.
| socket_t GetSocket | ( | ) |
| virtual bool IsReadable | ( | ) | const [virtual] |
| virtual bool IsWritable | ( | ) | const [virtual] |
| virtual int Listen | ( | unsigned short | _port | ) | [pure virtual] |
| virtual int Read | ( | std::string & | _output | ) | [virtual] |
Reads a block of data with a specified maximum size.
| _output | An std::string in which the data will be stored. |
| virtual int Read | ( | char * | _output, | |
| unsigned int * | _len | |||
| ) | [virtual] |
Reads a block of data with a specified maximum size.
| _output | A buffer with size _len. Will contain the received data on return. | |
| _len | The maximum number of bytes to read. On return, this will contain the size of data received. |
| virtual int Send | ( | std::string | _data | ) | [virtual] |
Sends a string.
| _data | The string to be sent. |
| virtual int Send | ( | const void * | _data, | |
| size_t | _length | |||
| ) | [virtual] |
Sends a block of data.
| _data | The data to be sent. | |
| _length | The number of bytes of _data to send (must NOT exceed the size of _data). |
| virtual int SetAttributes | ( | socket_t | _socket | ) | [protected, pure virtual] |
| virtual socketState State | ( | ) | const [virtual] |
Fetch the state of the socket.
Reimplemented in TCPSocket.
1.5.8