| Jpp
    | 
Socket class. More...
#include <JSocket.hh>
 
  
| Public Member Functions | |
| JSocket () | |
| Default constructor.  More... | |
| JSocket (const int type) | |
| Constructor.  More... | |
| JSocket (const int domain, const int type, const int protocol=0) | |
| Constructor.  More... | |
| int | shutdown () | 
| Shut down socket.  More... | |
| void | setNonBlocking (const bool on) | 
| Set non-blocking of I/O.  More... | |
| bool | getNonBlocking () const | 
| Get non-blocking of I/O.  More... | |
| void | setKeepAlive (const bool on) | 
| Set keep alive of socket.  More... | |
| bool | getKeepAlive () const | 
| Get keep alive of socket.  More... | |
| void | setKeepIdle (const int t_s) | 
| Set the TCP idle time.  More... | |
| void | setKeepCnt (const int count) | 
| Set the TCP idle count.  More... | |
| void | setKeepIntvl (const int t_s) | 
| Set the TCP interval time.  More... | |
| void | setReuseAddress (const bool on) | 
| Set reuse address.  More... | |
| bool | getReuseAddress () const | 
| Get reuse address.  More... | |
| void | setTcpNoDelay (const bool on) | 
| Set TCP no-delay.  More... | |
| bool | getTcpNoDelay () const | 
| Get TCP no-delay.  More... | |
| void | setReceiveBufferSize (const int size) | 
| Set receive buffer size.  More... | |
| int | getReceiveBufferSize () const | 
| Set receive buffer size.  More... | |
| void | setSendBufferSize (const int size) | 
| Set send buffer size.  More... | |
| int | getSendBufferSize () const | 
| Get send buffer size.  More... | |
| virtual int | read (char *buffer, const int length) | 
| Read data from socket.  More... | |
| virtual int | write (const char *buffer, const int length) | 
| Write data to socket.  More... | |
| void | accept (const int server) | 
| Accept connection from a server.  More... | |
| void | connect (const int port) | 
| Connect to port on local host.  More... | |
| void | connect (const std::string &host_name, const int port) | 
| Connect to port on specified host.  More... | |
| void | connect (const int ip_number, const int port) | 
| Connect to port on specified host.  More... | |
| void | close () | 
| Close file.  More... | |
| bool | in_avail (JTimeval timeout=JTimeval::min()) const | 
| Check availability of input.  More... | |
| bool | out_avail (JTimeval timeout=JTimeval::min()) const | 
| Check availability of output.  More... | |
| virtual bool | good () const | 
| Check status.  More... | |
| virtual bool | fail () const | 
| Check status.  More... | |
| virtual bool | bad () const | 
| Check status.  More... | |
| virtual bool | eof () const | 
| Check end of file.  More... | |
| bool | less (const JAbstractFile &file) const | 
| Less than operation.  More... | |
| int | getFileDescriptor () const | 
| Get file descriptor.  More... | |
| bool | is_open () const | 
| Get open status.  More... | |
| const sockaddr * | getSockaddr () const | 
| Get sockaddr.  More... | |
| sockaddr * | getSockaddr () | 
| Get sockaddr.  More... | |
| int | getFamily () const | 
| Get family.  More... | |
| void | setFamily (const int family) | 
| Set family.  More... | |
| std::string | getHostname () const | 
| Get host name.  More... | |
| int | getIPnumber () const | 
| Get IP number.  More... | |
| void | setIPnumber (const int ip_number) | 
| Set IP number.  More... | |
| void | setIPnumber () | 
| Set any IP number.  More... | |
| int | getPort () const | 
| Get port number.  More... | |
| void | setPort (const int port) | 
| Set port number.  More... | |
| Static Public Member Functions | |
| static int | sizeOf () | 
| Get size of object.  More... | |
| 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.  More... | |
| template<class T > | |
| T | getOption (const int level, const int option) const | 
| Get socket option.  More... | |
| Protected Attributes | |
| int | fileDescriptor | 
| Private Attributes | |
| int | result | 
Socket class.
Definition at line 42 of file JSocket.hh.
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
Constructor.
| domain | communication domain | 
| type | socket type | 
| protocol | protocol | 
Definition at line 78 of file JSocket.hh.
| 
 | inline | 
| 
 | inline | 
Set non-blocking of I/O.
| on | true to enable non-blocking; false to disable | 
Definition at line 109 of file JSocket.hh.
| 
 | inline | 
Get non-blocking of I/O.
Definition at line 133 of file JSocket.hh.
| 
 | inline | 
Set keep alive of socket.
| on | true to enable keep alive; false to disable | 
Definition at line 151 of file JSocket.hh.
| 
 | inline | 
Get keep alive of socket.
Definition at line 162 of file JSocket.hh.
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
Set reuse address.
| on | true to enable reuse address; false to disable | 
Definition at line 206 of file JSocket.hh.
| 
 | inline | 
Get reuse address.
Definition at line 217 of file JSocket.hh.
| 
 | inline | 
Set TCP no-delay.
| on | true to set TCP no-delay; false to disable | 
Definition at line 228 of file JSocket.hh.
| 
 | inline | 
Get TCP no-delay.
Definition at line 239 of file JSocket.hh.
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
| 
 | inline | 
| 
 | inlinevirtual | 
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.
Definition at line 300 of file JSocket.hh.
| 
 | inlinevirtual | 
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.
Definition at line 339 of file JSocket.hh.
| 
 | inline | 
Accept connection from a server.
| server | file descriptor of server socket | 
Definition at line 372 of file JSocket.hh.
| 
 | inline | 
Connect to port on local host.
| port | port number | 
Definition at line 384 of file JSocket.hh.
| 
 | inline | 
Connect to port on specified host.
| host_name | host name | 
| port | port number | 
Definition at line 396 of file JSocket.hh.
| 
 | inline | 
Connect to port on specified host.
| ip_number | IP number | 
| port | port number | 
Definition at line 408 of file JSocket.hh.
| 
 | inlineprotected | 
Set socket option.
| level | level | 
| option | option | 
| value | value | 
Definition at line 428 of file JSocket.hh.
| 
 | inlineprotected | 
Get socket option.
| level | level | 
| option | option | 
Definition at line 446 of file JSocket.hh.
| 
 | inlineinherited | 
Check availability of input.
This method returns true if at least one byte can be read without blocking.
| timeout | timeout | 
| 
 | inlineinherited | 
Check availability of output.
This method returns true if at least one byte can be written without blocking.
| timeout | timeout | 
| 
 | inlinevirtualinherited | 
| 
 | inlinevirtualinherited | 
| 
 | inlinevirtualinherited | 
| 
 | inlinevirtualinherited | 
| 
 | inlineinherited | 
Less than operation.
| file | JAbstractFile to be compared | 
Definition at line 64 of file JAbstractFile.hh.
| 
 | inlineinherited | 
| 
 | inlineinherited | 
Get open status.
Definition at line 84 of file JAbstractFile.hh.
| 
 | inlineinherited | 
| 
 | inlineinherited | 
| 
 | inlineinherited | 
| 
 | inlineinherited | 
| 
 | inlineinherited | 
| 
 | inlineinherited | 
| 
 | inlineinherited | 
| 
 | inlineinherited | 
Set any IP number.
Definition at line 119 of file JSocketAddress.hh.
| 
 | inlineinherited | 
| 
 | inlineinherited | 
| 
 | inlinestaticinherited | 
| 
 | staticinherited | 
Definition at line 27 of file JAbstractFile.hh.
| 
 | protectedinherited | 
Definition at line 91 of file JAbstractFile.hh.
 1.8.16
 1.8.16