Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Sep : Re: Need help on simple understanding of connections...
| Subject: | Re: Need help on simple understanding of connections... |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Tue, 19 Sep 2006 16:46:03 |
"Warren O. Merrill" <wom@inel.gov> wrote in message
news:45107c60$1@newsgroups.borland.com...
> On the dialog that pops up for the example program it has two entries
> that I don't understand. One says 'Listen on and is defaulted to 1000.
That is the port number that the program will listen on when accepting
incoming connections.
> The other says 'Host:' and has a default of 127.0.0.1:1000.
That is the IP and port number that the program will make outgoing
connections to.
> What I don't understand is how to simply bring up two copies of
> this and see the basics of how it works.
The default values are already set up for it. If you run both instances on
the same machine, then one instance will listen on port 1000, and the other
instance will connect to port 1000.
> I often get a number of errors popping up
Such as?
> Do I start two copies of this same test program on the same machine
If you use the default values as-is, then yes.
> or two different machines
You can. You would have to change the Host value on the connecting instance
to specify the IP of the machine that the listening instance is running on.
> or can it be used either way?
It can be used either way.
> If I start both on the same machine what settings do I use for the two
> copies (i.e. both set to listen on 1000 and Host as 127.0.0.1:1000?)
Only one instance must listen. The other connects to the listener.
> If I use two different machines how would I set things (assuming
> I know the real IP addresses of those machines)?
In the instance that will be connecting, simply specify the Host IP of the
listener.
> Is the listening number set to the same as the Host number in the same
copy of the app
No.
> or the Host number of the other copy of the app?
Yes. Though it is the other way around - set the Host Port to be the same
as the listening Port.
> If I start two copies of the app on the local machine I should set the
> params so it works as follows:
>
> App copy #1 Listen on set to: 1000 ???
> App copy #1 Host set to: 127.0.0.1:1000 ???
An instance of the application does not connect to its own listening port.
Use one set of numbers or the other, not both.
App copy #1 Listen on set to: 1000
App copy #2 Host set to: <App1IP>:<App1Port>
App copy #2 Listen on set to: 1000
App copy #1 Host set to: <App2IP>:<App2Port>
Gambit
none