At the top of your application, include vmci_sockets.h and declare a constant for buffer size. This does not have to be based on the size of a UDP datagram.
The sockaddr_vm structure contains an element for the CID to specify the virtual machine. For the client making a connection, the
VMCISock_GetLocalCID() function returns the CID of the virtual machine.
Even with this connectionless protocol, applications can call the connect() function once to set the address, and call the
send() function repeatedly without having to specify the
sendto() address each time.
The recvfrom() call optionally reads data from the server application. See
Recvfrom() Function.
The close() call shuts down a connection, given the original socket descriptor obtained from the
socket() function. To compile on Windows, call the Winsock
closesocket(), as shown in
Close() Function.