I would like to send datagrams (text commands) via UDP from a Windows PC to Raspberry Pi. The Windows PC will act as the client (sending the command) whilst the Raspberry Pi will be the server (receiving commands). I only managed to do it in Linux (which I can't use for various reasons) and besides that I could only send and receive packets from the same (one) PC. Is it possible to do such thing, or would their be a conflict between Windows and Raspbian? Thanks in advance.
The protocol is same, how it can be in conflict. Practically, API is close to BSD \\ POSIX, you just need make sure to intialise WinSocks with special call and cleanup it at end
WSADATA wsaData;
if( WSAStartup(MAKEWORD(2,2), &wsaData) != 0)
{
printf("Server: WSAStartup failed with error %ld\n", WSAGetLastError());
return -1;
}
else
printf("Server: The Winsock DLL status is %s.\n", wsaData.szSystemStatus);
Call WSACleanup(); when app doesn't need sockets anymore (before exit?) There is more to Winsock's than that
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.