We help IT Professionals succeed at work.

Question about Indy Socket components in Delphi 6

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

Commented:
Yes you can, it's easy.

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

oila!

Commented:
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.

GL
Mike

Commented:
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.

Commented:
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.