| View previous topic :: View next topic |
| Author |
Message |
ug Guest
|
Posted: Fri Apr 02, 2004 7:42 pm Post subject: Specifying Client IP Address with Indy |
|
|
Hi,
Is it possible to specify the IP address a client (TIdUDPClient,
TIdTCPClient) uses when sending/receiving data?
I have a computer with 2 IP-Addresses (and one LAN adapter). The client
sometimes has to use the first IP address and sometimes the second IP
address.
How is it possible to implement that, since the client binds automatically
to the primary IP address of LAN adapter (IP stack).
Thanks,
Uli
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Apr 05, 2004 7:28 pm Post subject: Re: Specifying Client IP Address with Indy |
|
|
"ug" <ugarbe (AT) vt4 (DOT) net> wrote
| Quote: | Is it possible to specify the IP address a client (TIdUDPClient,
TIdTCPClient) uses when sending/receiving data?
|
Yes. Look at the BoundIP property in TIdTCPClient, and the Binding.IP
property in TIdUDPClient.
| Quote: | the client binds automatically to the primary IP address
of LAN adapter (IP stack).
|
Only when you don't specify your own binding info prior to opening the
connection.
Gambit
|
|
| Back to top |
|
 |
Wykis Guest
|
Posted: Wed Apr 07, 2004 10:20 am Post subject: Re: Specifying Client IP Address with Indy |
|
|
This Will Give You IP Of Client: AThread.Connection.LocalName
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Apr 07, 2004 5:51 pm Post subject: Re: Specifying Client IP Address with Indy |
|
|
"Wykis" <wykis (AT) mail (DOT) com> wrote
| Quote: | This Will Give You IP Of Client: AThread.Connection.LocalName
|
No, it will not. It will give you the host name of the server. You are
thinking of the PeerIP property instead:
AThread.Connection.Socket.Binding.PeerIP
However, either way this does not address the actual issue that ug is asking
about.
Gambit
|
|
| Back to top |
|
 |
ug Guest
|
Posted: Tue Apr 20, 2004 5:37 pm Post subject: Re: Specifying Client IP Address with Indy |
|
|
Thanks for the answer. Sorry I was out for a while.
For IdTCPClient the solution works.
For IdUDPClient I'll test it this week.
Uli
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> schrieb im
Newsbeitrag news:4071b35c$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"ug" <ugarbe (AT) vt4 (DOT) net> wrote in message
news:406dc0f0 (AT) newsgroups (DOT) borland.com...
Is it possible to specify the IP address a client (TIdUDPClient,
TIdTCPClient) uses when sending/receiving data?
Yes. Look at the BoundIP property in TIdTCPClient, and the Binding.IP
property in TIdUDPClient.
the client binds automatically to the primary IP address
of LAN adapter (IP stack).
Only when you don't specify your own binding info prior to opening the
connection.
Gambit
|
|
|
| Back to top |
|
 |
ug Guest
|
Posted: Wed Apr 21, 2004 7:55 pm Post subject: Re: Specifying Client IP Address with Indy |
|
|
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> schrieb im
Newsbeitrag news:4071b35c$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"ug" <ugarbe (AT) vt4 (DOT) net> wrote in message
news:406dc0f0 (AT) newsgroups (DOT) borland.com...
Is it possible to specify the IP address a client (TIdUDPClient,
TIdTCPClient) uses when sending/receiving data?
Yes. Look at the BoundIP property in TIdTCPClient, and the Binding.IP
property in TIdUDPClient.
the client binds automatically to the primary IP address
of LAN adapter (IP stack).
Only when you don't specify your own binding info prior to opening the
connection.
Gambit
|
|
|
| Back to top |
|
 |
ug Guest
|
Posted: Wed Apr 21, 2004 7:56 pm Post subject: Re: Specifying Client IP Address with Indy |
|
|
I tried the solution for IdUDPClient (or better with IdSNMPClient).
I assigned the 'second' IP address of the computer to SNMPClient.Binding.IP
but the request is sent out with the 'primary' address. Is there s.th. I'm
missing?
The second IP address is assigned to the interface, and works well with TCP
clients.
This is the code:
SNMPClient.Host := ServerIP;
SNMPClient.Port := ServerPort;
SNMPClient.Binding.IP := ClientIP;
SNMPClient.ReceiveTimeout := timeout;
SNMPClient.QuickSend(MIB_String, Community_String, ServerIP,
Receive_String);
Uli
"Remy Lebeau (TeamB)" <gambit47.no.spam (AT) no (DOT) spam.yahoo.com> schrieb im
Newsbeitrag news:4071b35c$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"ug" <ugarbe (AT) vt4 (DOT) net> wrote in message
news:406dc0f0 (AT) newsgroups (DOT) borland.com...
Is it possible to specify the IP address a client (TIdUDPClient,
TIdTCPClient) uses when sending/receiving data?
Yes. Look at the BoundIP property in TIdTCPClient, and the Binding.IP
property in TIdUDPClient.
the client binds automatically to the primary IP address
of LAN adapter (IP stack).
Only when you don't specify your own binding info prior to opening the
connection.
Gambit
|
|
|
| Back to top |
|
 |
|