I am interested in how to correctly request data via the client. For example, the server has two types of data. I would like to ask for data under the letter a
Client Server
| |
| | for example an array
| | a - data (1,2,3,4,5)
| how to ask? | /
sendto - - - - - - a - - - - -> recvfrom
| | \
| | b - data (0,0,0,2,1)
| |
| |
recvfrom <- - - - - a - - - - - - sendto
|
|
|
a (1,2,3,4,5)
At the moment I send data and get it like this
#include <WinSock2.h>
#include <Ws2tcpip.h>
amountRead = recvfrom(sock, (char*)&array_a, sizeof array_a, 0, (LPSOCKADDR)&sAddr, &sizeAddr);
if (amountRead == SOCKET_ERROR) {
std::cout << " WARNING: " << "\t" << std::endl;
}
else {
std::cout << " GOOD: " << "\t" << std::endl;
}
sendto(sock, (char*)&array_a, sizeof array_a, 0, (LPSOCKADDR)&sAddr, sizeAddr);
As you understand now there is no second data, all because I do not know how to make a check on the server at the request of the client and also do not know what the client should send to the server to get certain data.
