1 #ifndef __JNET__JTCPSOCKET__ 
    2 #define __JNET__JTCPSOCKET__ 
   18 namespace JPP { 
using namespace JNET; }
 
   45       const int mask  = FNDELAY;
 
   51       if (((flags & mask) != mask &&  on) ||
 
   52           ((flags & mask) != 0    && !on) ) {
 
   69       const int mask  = FNDELAY;
 
   75       return ((flags & mask) != 0);
 
  119       setOption(IPPROTO_TCP, TCP_NODELAY, 
int(on ? 1 : 0));
 
  130       return (getOption<int>(IPPROTO_TCP, TCP_NODELAY) == 1);
 
  141       socklen_t size = 
sizeof(sockaddr_in);
 
  187     void connect(
const int ip_number, 
const int port)
 
int getIPnumber(const std::string &host_name)
Get IP number. 
 
void setKeepIdle(const int t_s)
Set the TCP idle time. 
 
bool getTcpNoDelay() const 
Get TCP no-delay. 
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message. 
 
std::string getIPaddress(const int ip)
Get IP address (decimal-dot notation). 
 
Auxiliary data structure for hostname and port number. 
 
void setIPnumber()
Set any IP number. 
 
void setKeepCnt(const int count)
Set the TCP idle count. 
 
void connect(const std::string &hostname, const int port)
Connect to port on specified host. 
 
const sockaddr * getSockaddr() const 
Get sockaddr. 
 
int getFileDescriptor() const 
Get file descriptor. 
 
void accept(const int server)
Accept connection from a server. 
 
void connect(const int ip_number, const int port)
Connect to port on specified host. 
 
void setPort(const int port)
Set port number. 
 
void setTcpNoDelay(const bool on)
Set TCP no-delay. 
 
bool getNonBlocking() const 
Get non-blocking of I/O. 
 
JTCPSocket()
Default constructor. 
 
void connect(const int port)
Connect to port on local host. 
 
void connect(const JHostname &hostname)
Connect to port on specified host. 
 
void setNonBlocking(const bool on)
Set non-blocking of I/O. 
 
Base class for interprocess communication. 
 
void setOption(const int level, const int option, const T value)
Set socket option. 
 
Hostname and IP address functions. 
 
void setKeepIntvl(const int t_s)
Set the TCP interval time.