I am using C, Linux, and a GIO GSocket to build a small application to communicate with a digital projector via TCP. The socket connects successfully and I am able to send messages to the projector successfully. My problem is that I am not able to receive the automated acknowledgement messages returned by the projector when it receives a command. When I send a message then use g_socket_receive, it blocks and never seems to receive a response.
My suspicion of the problem, based on past similar issues in other languages, is that when I send a message using g_socket_send the message is sent on a random available local port. The projector then automatically replies to the port the message originated from. Not knowing what port it used, I am unable to have my GSocket listen on the correct port. In other languages it's been a simple matter of manually setting my local outbound port so that I knew where the response would come back to. However I have not been able to find any information at all about how to do so with a GSocket.
Can anyone offer any assistance with this, or any thoughts on what else the problem could be that I'm missing?
Thanks!