Client will now close listener thread when disconnected and attempt to reconnect. Initialization behavior (controller requests, client string update) are performed automatically upon reconnection

This commit is contained in:
Adam Honse 2020-05-10 01:19:33 -05:00
parent 5133c30242
commit e2c2b8c1df
4 changed files with 205 additions and 93 deletions

View file

@ -127,7 +127,8 @@ bool net_port::tcp_client(const char * client_name, const char * port)
bool net_port::tcp_client_connect()
{
if (!connected)
connected = false;
{
sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == INVALID_SOCKET)
@ -185,7 +186,7 @@ bool net_port::tcp_client_connect()
closesocket(sock);
}
}
return(true);
return(connected);
}
bool net_port::tcp_server(const char * port)

View file

@ -71,12 +71,13 @@ public:
void tcp_close();
bool connected;
SOCKET sock;
private:
#ifdef WIN32
WSADATA wsa;
#endif
SOCKET sock;
std::vector<SOCKET *> clients;
sockaddr addrDest;