It consists of 1 client and 1 server,using BSD sockets. Both sockets are created using:
socket(AF_INET, SOCK_STREAM, 0);
The server socket is set to non blocking using:
u_long iMode=1; ioctlsocket(Socket,FIONBIO,&iMode);
My client repeatedly sends the mouse position every frame to the server using write. It does this when ever the mouse moves. Thats all it does, so its going pretty fast. It doesnt perform any reads.
My server is in a simple loop, where each frame it:
- performs a read on the connected client socket, decodes the message if there was one, then sets the position of an image to the x/y position from the message
- draws the image
data is read and written using send() and recv()
However im finding there is significant lag. I would have thought it could handle this?
Im not sure where my bottle neck is?