|
Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
|
Socket class. More...
#include <JSocket.hh>
Public Member Functions | |
| JSocket () | |
| Default constructor. | |
| JSocket (const int domain, const int type, const int protocol=0) | |
| Constructor. | |
| int | shutdown () |
| Shut down socket. | |
| void | setKeepAlive (const bool on) |
| Set keep alive of socket. | |
| bool | getKeepAlive () const |
| Get keep alive of socket. | |
| void | setReuseAddress (const bool on) |
| Set reuse address. | |
| bool | getReuseAddress () const |
| Get reuse address. | |
| void | setReceiveBufferSize (const int size) |
| Set receive buffer size. | |
| int | getReceiveBufferSize () const |
| Set receive buffer size. | |
| void | setSendBufferSize (const int size) |
| Set send buffer size. | |
| int | getSendBufferSize () const |
| Get send buffer size. | |
| virtual int | read (char *buffer, const int length) override |
| Read data from socket. | |
| virtual int | write (const char *buffer, const int length) override |
| Write data to socket. | |
| int | close () |
| Close file. | |
| bool | in_avail (JTimeval timeout=JTimeval::min()) const |
| Check availability of input. | |
| bool | out_avail (JTimeval timeout=JTimeval::min()) const |
| Check availability of output. | |
| virtual bool | good () const |
| Check status. | |
| virtual bool | fail () const |
| Check status. | |
| virtual bool | bad () const |
| Check status. | |
| virtual bool | eof () const |
| Check end of file. | |
| bool | less (const JAbstractFile &file) const |
| Less than operation. | |
| int | getFileDescriptor () const |
| Get file descriptor. | |
| void | setFileDescriptor (const int file) |
| Set file descriptor. | |
| bool | is_open () const |
| Get open status. | |
| const sockaddr * | getSockaddr () const |
| Get sockaddr. | |
| sockaddr * | getSockaddr () |
| Get sockaddr. | |
| int | getFamily () const |
| Get family. | |
| void | setFamily (const int family) |
| Set family. | |
| std::string | getHostname () const |
| Get host name. | |
| int | getIPnumber () const |
| Get IP number. | |
| void | setIPnumber (const int ip_number) |
| Set IP number. | |
| void | setIPnumber () |
| Set any IP number. | |
| int | getPort () const |
| Get port number. | |
| void | setPort (const int port) |
| Set port number. | |
Static Public Member Functions | |
| static const int | getDefaultBufferSize () |
| Default socket buffer size to be used on this system. | |
| static int | sizeOf () |
| Get size of object. | |
Static Public Attributes | |
| static const int | FILE_CLOSED = -1 |
Protected Member Functions | |
| template<class T > | |
| void | setOption (const int level, const int option, const T value) |
| Set socket option. | |
| template<class T > | |
| T | getOption (const int level, const int option) const |
| Get socket option. | |
Protected Attributes | |
| int | fileDescriptor |
Private Attributes | |
| int | result |
Socket class.
Definition at line 38 of file JSocket.hh.
|
inline |
Default constructor.
Definition at line 46 of file JSocket.hh.
Constructor.
| domain | communication domain |
| type | socket type |
| protocol | protocol |
Definition at line 58 of file JSocket.hh.
Default socket buffer size to be used on this system.
Definition at line 75 of file JSocket.hh.
|
inline |
Shut down socket.
Definition at line 89 of file JSocket.hh.
Set keep alive of socket.
| on | true to enable keep alive; false to disable |
Definition at line 104 of file JSocket.hh.
|
inline |
Get keep alive of socket.
Definition at line 115 of file JSocket.hh.
Set reuse address.
| on | true to enable reuse address; false to disable |
Definition at line 126 of file JSocket.hh.
|
inline |
Get reuse address.
Definition at line 137 of file JSocket.hh.
|
inline |
Set receive buffer size.
Definition at line 159 of file JSocket.hh.
|
inline |
Get send buffer size.
Definition at line 181 of file JSocket.hh.
Read data from socket.
This method handles I/O errors in such a way that:
| buffer | buffer |
| length | number of bytes to read |
Reimplemented from JLANG::JFile.
Reimplemented in JNET::JSocketBlocking, JNET::JSocketInputChannel< JPrefix_t >, JNET::JSocketNonblockingReader, JNET::JUDPSocket, and JNET::JUDPSocket.
Definition at line 198 of file JSocket.hh.
Write data to socket.
This method handles I/O errors in such a way that:
| buffer | buffer |
| length | number of bytes to write |
Reimplemented from JLANG::JFile.
Reimplemented in JNET::JSocketBlocking, JNET::JSocketOutputChannel< JPrefix_t >, JNET::JSocketNonblockingWriter, and JNET::JUDPSocket.
Definition at line 237 of file JSocket.hh.
|
inlineprotected |
Set socket option.
| level | level |
| option | option |
| value | value |
Definition at line 274 of file JSocket.hh.
|
inlineprotected |
Get socket option.
| level | level |
| option | option |
Definition at line 292 of file JSocket.hh.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Less than operation.
| file | JAbstractFile to be compared |
Definition at line 64 of file JAbstractFile.hh.
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
Get open status.
Definition at line 95 of file JAbstractFile.hh.
Get sockaddr.
Definition at line 44 of file JSocketAddress.hh.
|
inlineinherited |
Get sockaddr.
Definition at line 55 of file JSocketAddress.hh.
|
inlineinherited |
Get family.
Definition at line 66 of file JSocketAddress.hh.
Set family.
| family | family |
Definition at line 77 of file JSocketAddress.hh.
|
inlineinherited |
Get host name.
Definition at line 88 of file JSocketAddress.hh.
|
inlineinherited |
Get IP number.
Definition at line 99 of file JSocketAddress.hh.
Set IP number.
| ip_number | IP number |
Definition at line 110 of file JSocketAddress.hh.
|
inlineinherited |
Set any IP number.
Definition at line 119 of file JSocketAddress.hh.
|
inlineinherited |
Get port number.
Definition at line 130 of file JSocketAddress.hh.
Set port number.
| port | port number |
Definition at line 141 of file JSocketAddress.hh.
Get size of object.
Definition at line 155 of file JSocketAddress.hh.
Definition at line 27 of file JAbstractFile.hh.
|
protectedinherited |
Definition at line 102 of file JAbstractFile.hh.