Question

Sorry, links to Indy documentation are currently not working for me. I don't know if the sites are down or whatever but they're not loading in my browser at the moment.

I have a TIdCmdTcpServer in one "server" application, and a TIdCmdTcpClient in another "client" application. I know how to get the IP address of the Client once it has connected. What I don't know is how to distinguish between 2 clients that connect from the same ip address. Can anyone help?

Was it helpful?

Solution

This isn't really an Indy question, more a general networking one.

Different clients at the same address must use distinct ports. And here I mean the port at the client end of the connection. So you distinguish between different clients at the same address by dint of them using different ports.

OTHER TIPS

DO NOT use TIdCmdTCPClient with TIdCmdTCPServer. They are not meant to be used together, and it is very easy to deadlock your communications with them, as they both use internal reading threads that expect the other peer to send data. Use TIdTCPClient with TIdCmdTCPServer or TIdCmdTCPClient with TIdTCPServer.

With that said, you could use the client's remote IP/Port to differentiate, but it is generally better to make your own identifier instead, such as requiring clients to log in with a username, that you can then track as needed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top