| View previous topic :: View next topic |
| Author |
Message |
Joe Guest
|
Posted: Sun Nov 21, 2004 10:06 am Post subject: How does Indy handle multi IP Address on one host? |
|
|
for example:
i have a host with two netcard installed.
one connected to the local network,
the other connected to the ADSL modem,
thus the host will have two IP Address
after connected to internet.
now i'm using Indy to develop a software to
communicate within my local network. but
how to let Indy use the local IP Address
not the dynamic one(allocated by ADSL
modem) when communicating?
|
|
| Back to top |
|
 |
Don Siders Guest
|
Posted: Sun Nov 21, 2004 10:17 am Post subject: Re: How does Indy handle multi IP Address on one host? |
|
|
| Quote: | i have a host with two netcard installed.
one connected to the local network,
the other connected to the ADSL modem,
how to let Indy use the local IP Address
not the dynamic one(allocated by ADSL
modem) when communicating?
|
See the documentation for the TIdTCPServer.Bindings property.
|
|
| Back to top |
|
 |
Joe Wuang Guest
|
Posted: Sun Nov 21, 2004 11:56 am Post subject: Re: How does Indy handle multi IP Address on one host? |
|
|
| Quote: | See the documentation for the TIdTCPServer.Bindings property.
|
for example: host A has two IP address, B is another host
in the same Lan with host A. the server side of my
software is running on host B, the client side is running on
host A. now the client side(on host A) send message to
server side(on host B) , how server side to get the correct
IP Address of client side ?
|
|
| Back to top |
|
 |
Don Siders Guest
|
Posted: Sun Nov 21, 2004 1:04 pm Post subject: Re: How does Indy handle multi IP Address on one host? |
|
|
| Quote: | how server side to get the correct
IP Address of client side ?
|
Please see the Server section in the Indy Knowledge Base ([url]http://www.indyproject.org/KB/)[/url].
|
|
| Back to top |
|
 |
Joe Wuang Guest
|
Posted: Mon Nov 22, 2004 6:54 am Post subject: Re: How does Indy handle multi IP Address on one host? |
|
|
->Please see the Server section in the Indy Knowledge Base
([url]http://www.indyproject.org/KB/)[/url].
i did exactly the way described in KB. but always get
the wrong IP.
is there some place to specify the client to use which IP
to communicate?
|
|
| Back to top |
|
 |
Joe Wuang Guest
|
Posted: Mon Nov 22, 2004 1:41 pm Post subject: Re: How does Indy handle multi IP Address on one host? |
|
|
->Please see the Server section in the Indy Knowledge Base
([url]http://www.indyproject.org/KB/)[/url].
i'm sorry.
when using TIdTCPServer or TIdUDPServer i can get the correct IP.
now i want to use IdIPMCastServer and
IdIPMCastClient. the server side is running on host A
which has two IP, the client side is running on host B.
then server side send multi-cast message and client side
on host B will receive it. how can host B get the host A's
correct IP(the IP used in local Lan).
|
|
| Back to top |
|
 |
Don Siders Guest
|
Posted: Mon Nov 22, 2004 2:00 pm Post subject: Re: How does Indy handle multi IP Address on one host? |
|
|
| Quote: | ->Please see the Server section in the Indy Knowledge Base
([url]http://www.indyproject.org/KB/)[/url].
i did exactly the way described in KB. but always get
the wrong IP.
is there some place to specify the client to use which IP
to communicate?
|
I really don't undersand your question.
You have a connection established in a server thread or context. How could it be the wrong IP? What is it exactly that makes you think it's the wrong IP?
Unless you're using the wrong value...
Binding.IP - the server IP
Binding.Port - the server port number
Binding.PeerIP - the client IP
Binding.PeerPort - the client port number
hth...
|
|
| Back to top |
|
 |
Don Siders Guest
|
Posted: Mon Nov 22, 2004 4:51 pm Post subject: Re: How does Indy handle multi IP Address on one host? |
|
|
| Quote: | when using TIdTCPServer or TIdUDPServer i can get
the correct IP.
now i want to use IdIPMCastServer and
IdIPMCastClient.
|
Oh, multicast... it's different.
| Quote: | the server side is running on host A
which has two IP, the client side is running on host B.
then server side send multi-cast message and client side
on host B will receive it. how can host B get the host A's
correct IP(the IP used in local Lan).
|
For IP Multicast, the IP address is set to the Multicast Group Address. The local network interface is always bound to INADDR_ANY (0.0.0.0), so you cannot get the real local IP address. If you need the senders end-point, you'll need to include it as part of the datagram.
For instance, using IP Multicast to notify clients when a server is online or going offline. The server information needs to be sent in a datagram since IP Multicast doesn't maintain or broadcast group membership. This type of operation is generally implemented in a higher-level protocol layered on top of the multicast mechanism.
See http://www.rfc-editor.org/rfc/rfc1458.txt.
hth
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Nov 22, 2004 7:46 pm Post subject: Re: How does Indy handle multi IP Address on one host? |
|
|
"Joe Wuang" <joeyeah (AT) msn (DOT) com> wrote
| Quote: | ->Please see the Server section in the Indy Knowledge Base
([url]http://www.indyproject.org/KB/)[/url].
i did exactly the way described in KB. but always get
the wrong IP.
|
Please show your actual code. Where are you retreiving the IP from in the
first place? How are you passing it to Indy?
| Quote: | is there some place to specify the client to use which
IP to communicate?
|
The client can only connect to whatever IP is running the server. If you
need the server to tell the client which IP to connect to, then the server
has to publish the IP somewhere that the client can find it.
Gambit
|
|
| Back to top |
|
 |
Joe Wuang Guest
|
Posted: Tue Nov 23, 2004 1:48 am Post subject: Re: How does Indy handle multi IP Address on one host? |
|
|
| Quote: | Oh, multicast... it's different.
For IP Multicast, the IP address is set to the Multicast >Group Address.
The local network interface is always >bound to INADDR_ANY (0.0.0.0), so
you cannot get >the real local IP address. If you need the senders
end->point, you'll need to include it as part of the datagram.
For instance, using IP Multicast to notify clients when a >server is online
or going offline. The server information >needs to be sent in a datagram
since IP Multicast >doesn't maintain or broadcast group membership. This
type of operation is generally implemented in a higher->level protocol
layered on top of the multicast >mechanism.
See http://www.rfc-editor.org/rfc/rfc1458.txt.
hth
|
thanks a lot, i know what to do now.
and thanks Remy Lebeau
best wishes
|
|
| Back to top |
|
 |
Joe Wuang Guest
|
Posted: Tue Nov 23, 2004 1:59 am Post subject: Re: How does Indy handle multi IP Address on one host? |
|
|
| Quote: | Please show your actual code. Where are you retreiving the IP from in the
first place? How are you passing it to Indy?
|
i'm sorry for my inattention. the method
described in the KB works correctly.
| Quote: | The client can only connect to whatever IP is running the server. If you
need the server to tell the client which IP to connect to, then the server
has to publish the IP somewhere that the client can find it.
|
thanks for your reply, i'm clear now.
best wishes
|
|
| Back to top |
|
 |
|