We help IT Professionals succeed at work.

Question about Indy Socket components in Delphi 6

junnz asked
Can we run TCP client and TCP server on the same machine with Indy Sockets and how?
Watch Question

Yes you can, it's easy.

Just use a server socket and make it listen on say, port
Then make another prog (or even in the same program),
using a client socket and make it connect to localhost ( on port 2000.


Just wondering, but are you sure about that?  I know you can do that with the UDP vcl's, but UDP is a connectionless protocol - I would think that trying that with the TCP vcl's would result in a challenge with the port already being in use. I don't know for sure - I'd have to try it.


Ive done it myself in the past.  Albeit not with the INDY component suite, but I see no reason why it would work with one set of winsock controls and not with another.

Only the server binds to port a port number that it's listenin on for connections. The client doesn't
bind to a port to make a connection, so the two don't get in each other's way

Explore More ContentExplore courses, solutions, and other research materials related to this topic.