Hi,

I am pretty much a beginner with TCP programming, so my question might be very 
basic or even silly because of a lack of understanding.

I am writing a client software for an existing closed source server. I am 
sending TCP packets as requests to this server and of course, I am waiting for 
replies. In principle, this works nicely, but when starting two client 
processes on the same machine contacting the same server process, the replies 
are going back to *any* of them, not necessarily to the requesting instance.

Checking the communication with Wireshark, I can see that the replies go back 
to different ports on the client computer when the request was sent by 
different instances of the client, but my program obviously does not 
distinguish there.

My implementation looks as follows:
 
uses Blcksock;
 
// ...
 
MeiTCPBlockSocket := TTCPBlockSocket.Create;
MeiTCPBlockSocket.Connect(RemoteHost, RemotePort);
MeiTCPBlockSocket.ResetLastError;
 
// ...
 
MeiTCPBlockSocket.SendBuffer(@XCom, SizeOf(XCom));
 
// ...
 
BufferSize := MeiTCPBlockSocket.WaitingData;
SetLength(Buffer, BufferSize);
MeiTCPBlockSocket.RecvBufferEx(@Buffer[0], BufferSize, 2500);
 
// ...
 
MeiTCPBlockSocket.CloseSocket;
FreeAndNil(MeiTCPBlockSocket);

Any advice on what is wrong with this code would be highly appreciated!

Paul

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
synalist-public mailing list
synalist-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to