1 #ifndef __JNET__JTCPSOCKET__ 
    2 #define __JNET__JTCPSOCKET__ 
   13 #if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE) 
   14 #define TCP_KEEPIDLE TCP_KEEPALIVE 
   21 namespace JPP { 
using namespace JNET; }
 
   59       const int mask  = FNDELAY;
 
   65       if (((flags & mask) != mask &&  on) ||
 
   66           ((flags & mask) != 0    && !on) ) {
 
   83       const int mask  = FNDELAY;
 
   89       return ((flags & mask) != 0);
 
  133       setOption(IPPROTO_TCP, TCP_NODELAY, 
int(on ? 1 : 0));
 
  144       return (getOption<int>(IPPROTO_TCP, TCP_NODELAY) == 1);
 
  155       socklen_t size = 
sizeof(sockaddr_in);
 
  189     void connect(
const std::string& hostname, 
const int port)
 
  201     void connect(
const int ip_number, 
const int port)
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
 
Hostname and IP address functions.
 
Base class for interprocess communication.
 
int getFileDescriptor() const
Get file descriptor.
 
const sockaddr * getSockaddr() const
Get sockaddr.
 
void setIPnumber()
Set any IP number.
 
void setPort(const int port)
Set port number.
 
void setOption(const int level, const int option, const T value)
Set socket option.
 
void connect(const JHostname &hostname)
Connect to port on specified host.
 
void setKeepIdle(const int t_s)
Set the TCP idle time.
 
JTCPSocket(const int server)
Constructor.
 
void setKeepCnt(const int count)
Set the TCP idle count.
 
bool getNonBlocking() const
Get non-blocking of I/O.
 
void connect(const int ip_number, const int port)
Connect to port on specified host.
 
void connect(const int port)
Connect to port on local host.
 
void connect(const std::string &hostname, const int port)
Connect to port on specified host.
 
void accept(const int server)
Accept connection from a server.
 
void setKeepIntvl(const int t_s)
Set the TCP interval time.
 
void setNonBlocking(const bool on)
Set non-blocking of I/O.
 
bool getTcpNoDelay() const
Get TCP no-delay.
 
JTCPSocket()
Default constructor.
 
void setTcpNoDelay(const bool on)
Set TCP no-delay.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
std::string getIPaddress(const int ip)
Get IP address (decimal-dot notation).
 
int getIPnumber(const std::string &host_name)
Get IP number.
 
Auxiliary data structure for hostname and port number.