added connect timeout, fixed non-closed sockets on connect error

This commit is contained in:
john30
2018-04-04 17:25:39 +02:00
parent c7c5feaea6
commit 230abbb9fb
3 changed files with 58 additions and 9 deletions
+3 -1
View File
@@ -133,9 +133,11 @@ class TCPClient {
* initiate a tcp socket connection to a listening server.
* @param server the server name or ip address to connect.
* @param port the tcp port.
* @param timeout the connect, send, and receive timeout in seconds, or 0.
* @return pointer to an opened tcp socket.
*/
TCPSocket* connect(const string& server, const uint16_t& port);
TCPSocket* connect(const string& server, const uint16_t& port, int timeout = 0);
};
/**