|
NetCpp
v0.2
|
Virtual class for platform-dependent code. More...
#include <abstract_system_socket.hpp>

Public Member Functions | |
| virtual int | read (void *buf, size_t size)=0 |
| Method to read data from the socket. | |
| virtual int | write (const void *buf, size_t size)=0 |
| Method to write data to the socket. | |
| virtual bool | close ()=0 |
| Method to close the socket. | |
| virtual void | accept (AbstractSystemSocket *sock)=0 |
| Method to accept a connection on a socket. | |
| virtual void | connect (const Address &addr)=0 |
| Method to connect the socket to an address. | |
| virtual void | bind (const Address &addr)=0 |
| Method to bind the socket to an address. | |
| virtual void | listen (int max_pending_connections)=0 |
| Method to set the maximum number of pending connections. | |
| protocol | getProtocol () const |
| Method to get the socket protocol. | |
Protected Member Functions | |
| AbstractSystemSocket (const protocol &prot) | |
| Constructor. | |
Protected Attributes | |
| protocol | protocol_ |
| Protocol used by the socket. | |
Virtual class for platform-dependent code.
This is the virtual class which every platform-dependent implementation must inherit from. The class offers a set of primitives which must be implemented by the concrete derived classes.
Definition at line 47 of file abstract_system_socket.hpp.
|
inlineprotected |
Constructor.
The constructor is protected because only derived classes can use it.
| prot | Protocol used by the socket |
Definition at line 130 of file abstract_system_socket.hpp.
|
pure virtual |
Method to accept a connection on a socket.
| sock | Pointer to the socket on which the new connection must be accepted. |
| runtime_error | in case of error |
Implemented in PosixSocket.
|
pure virtual |
Method to bind the socket to an address.
| addr | Address which the socket must be bound to |
| runtime_error | in case of error |
Implemented in PosixSocket.
|
pure virtual |
Method to close the socket.
Note: currently there is no mechanism to re-open a closed socket.
Implemented in PosixSocket.
|
pure virtual |
Method to connect the socket to an address.
| addr | Address which the socket must be connected to |
| runtime_error | in case of error |
Implemented in PosixSocket.
|
inline |
Method to get the socket protocol.
This method returns the protocol, which has been set at socket creation (and cannot be changed).
Definition at line 118 of file abstract_system_socket.hpp.

|
pure virtual |
Method to set the maximum number of pending connections.
This method allows to set the maximum number of pending connections for stream (e.g., TCP) communications.
| max_pending_connections | Maximum number of pending connections |
| runtime_error | in case of error or non-streamed communication |
Implemented in PosixSocket.
|
pure virtual |
Method to read data from the socket.
The buffer is filled with the read data.
| p | buf Pointer to the memory address containing data |
| size | Number of bytes that must be read |
Implemented in PosixSocket.
|
pure virtual |
Method to write data to the socket.
| p | buf Pointer to the memory address containing data |
| size | Number of bytes that must be written |
Implemented in PosixSocket.
|
protected |
Protocol used by the socket.
This protocol is set during socket creation and cannot be changed.
Definition at line 131 of file abstract_system_socket.hpp.