Jump to content
Lindawb

Find which connection on WSocketThrdServer

Recommended Posts

Hello,

If I have 3 connections (sockets) with different name  connected to WSocketThrdServer

ConnectionA

ConnectionB

ConnectionC

each connection send different messages and muss receive related response, means

ConnectionA   if A then response from the server  send to  ConnectionA   'You connection A'

ConnectionB    if B response from the server  send to  ConnectionB   'You connection B'

ConnectionC   if C response from the server  send to  ConnectionC   'You connection C'

 

all connections are tcp protocol and all 3 connections from same IP address, same host

 

Basically reply to associated connection only.

 

Thank you

 

Edited by Lindawb

Share this post


Link to post

How you identify a connection depends on the protocol you are using, usually they will identify themselves in some way if they expect a customised response. 

 

Without a protocol, all you have is the remote IP address and port.

 

Your various posts here all suggest you should be using the HTTP components, which compress data and send headers and have authentication.

 

Unless you are expecting to handle hundreds of new connections each second, TWSocketThrdServer is not a good component to use, it is ancient and has not been tested for 10 years, there is no sample application using it.  TWSocketServer is the component used by all ICS server applications.

 

Angus

 

Share this post


Link to post

sorry, I use tcp if that is what you asking.

I wasn't clear, all 3 connection from same computer or IP,

 

Thanks

Edited by Lindawb

Share this post


Link to post

So you design your protocol to identify where each connection comes from, or work it out from the content of the data.  ICS has no idea.

 

Angus

Share this post


Link to post

Your 3 connections have unique couple local IP and local port. That remains valid while the connection stay opened. On the next connection, the local IP will change. Thats' all you have on the network layer.

 

You should probably design something in your communication protocol to identify a given connection. In HTTP implementation, it is common to use a cookie. That is small data sent by the server upon connection and sent back by the client with each subsequent send.

 

Designing your own (reliable) protocol requires advanced knowledge about TCP/IP and communication protocol.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×