Send and receive client string
This commit is contained in:
parent
9ff4314840
commit
edf1b251c0
5 changed files with 63 additions and 1 deletions
|
|
@ -431,6 +431,11 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info)
|
|||
SendReply_ControllerData(client_sock, header.pkt_dev_idx);
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_SET_CLIENT_NAME:
|
||||
//printf "NET_PACKET_ID_SET_CLIENT_NAME\r\n" );
|
||||
ProcessRequest_ClientString(client_sock, header.pkt_size, data);
|
||||
break;
|
||||
|
||||
case NET_PACKET_ID_RGBCONTROLLER_RESIZEZONE:
|
||||
//printf( "NET_PACKET_ID_RGBCONTROLLER_RESIZEZONE\r\n" );
|
||||
|
||||
|
|
@ -530,6 +535,26 @@ listen_done:
|
|||
}
|
||||
}
|
||||
|
||||
void NetworkServer::ProcessRequest_ClientString(int client_sock, unsigned int data_size, char *data)
|
||||
{
|
||||
for(unsigned int this_idx = 0; this_idx < ServerClients.size(); this_idx++)
|
||||
{
|
||||
if(ServerClients[this_idx]->client_sock == client_sock)
|
||||
{
|
||||
ServerClients[this_idx]->client_string = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
| Client info has changed, call the callbacks |
|
||||
\*-------------------------------------------------*/
|
||||
for(unsigned int callback_idx = 0; callback_idx < ClientInfoChangeCallbacks.size(); callback_idx++)
|
||||
{
|
||||
ClientInfoChangeCallbacks[callback_idx](ClientInfoChangeCallbackArgs[callback_idx]);
|
||||
}
|
||||
}
|
||||
|
||||
void NetworkServer::SendReply_ControllerCount(SOCKET client_sock)
|
||||
{
|
||||
NetPacketHeader reply_hdr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue