Now my question is, how to determine the received data is which server? How do you write call RecvFrom function?
CodePudding user response:
The client didn't receive much server functions,But you can open multiple ports link different servers,
Port of the server would be fixed,
CodePudding user response:
Int recvfrom (_In_ SOCKET s,
_Out_ char * buf,
_In_ int len,
_In_ int flags,
_Out_ struct sockaddr * from,
_Inout_opt_ int * fromlen
);
The from it contains send the IP address
https://msdn.microsoft.com/en-us/library/windows/desktop/ms740120 (v vs. 85). Aspx
CodePudding user response:
CodePudding user response:
Use of multiple processes,CodePudding user response:
Received will be returned to the sender IP, if cannot be judged through the IP, can add logo in the data transmissionCodePudding user response:
The client to connect to the server, will be assigned a socket descriptor, then each receives a packet, the socket descriptor in the callback function together as a parameter can be identifiedCodePudding user response:
CodePudding user response:
CodePudding user response:
Recvfrom a parameter is the source address, so distinguish server,CodePudding user response:
Not UDP client and server runs, by receiving package the address of the judgment