1 #ifndef REMOTE_PROTOCOLS_TCPUTIL_H
2 #define REMOTE_PROTOCOLS_TCPUTIL_H
6 #include "protocols/MMSException.h"
8 namespace remote
{ namespace protocols
{
10 int openServerSocket(struct sockaddr_in
& server
, unsigned int port
, int max_pending
, int retryInterval
);
11 int openClientSocket(std::string address
, unsigned int port
);
12 int nextClient( int serversock
, sockaddr_in
& client
);
14 void setSendTimeout(int fd
, long seconds
, long microseconds
);
15 void setKeepAlive( int fd
, int numProbes
, int idleTime
, int interval
);
16 void setSendBuffer( int fd
, int byteSize
);
18 in_addr_t
resolve(const char *ip_addr
);
19 const char *getHostByIp(in_addr ip
);
21 template<class T
> bool recv(int fd
, T
& value
);
22 template<class T
> bool send(int fd
, T value
);
24 template<class T
> uint8_t* readvalue(T
& value
,uint8_t* buffer
, uint32_t& buflen
);
25 template<class T
> uint8_t* writevalue(T value
,uint8_t* buffer
, uint32_t& buflen
);