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:
parent
5133c30242
commit
e2c2b8c1df
4 changed files with 205 additions and 93 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue