24 # define TCPSOCKET_HH_ 101 void connect(
const std::string& hostname,
int port);
166 std::string& host,
unsigned int psize);
TcpSocket(PROTO_KIND pkind, SOCKET_VERSION version=V4)
TcpSocket * accept() const
accept a new client (For server only)
std::string _read_line_bin(int socket, int &port, std::string &host, unsigned int psize)
Get a line from socket and store client hostname and port in port and host variable (when used with b...
Network namespace represent all networks connection.
void close()
Close the connection.
void connect(const std::string &hostname, int port)
Connect as an TCP client.
TcpSocket(SOCKET_VERSION version=V4)
This class represent an abstract socket connection (udp | tcp server | tcp client) ...
enum Network::e_version SOCKET_VERSION
enum Network::e_pkind PROTO_KIND
std::string get_ip(TcpSocket *client) const
return ip of client (after an accept)
TcpSocket(int socket, PROTO_KIND pkind, SOCKET_VERSION version=V4)
TcpSocket(int socket, SOCKET_VERSION version=V4)
This class represent a tcp connection (client and server)