BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Specifying Client IP Address with Indy

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
ug
Guest





PostPosted: Fri Apr 02, 2004 7:42 pm    Post subject: Specifying Client IP Address with Indy Reply with quote



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





PostPosted: Mon Apr 05, 2004 7:28 pm    Post subject: Re: Specifying Client IP Address with Indy Reply with quote




"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





PostPosted: Wed Apr 07, 2004 10:20 am    Post subject: Re: Specifying Client IP Address with Indy Reply with quote



This Will Give You IP Of Client: AThread.Connection.LocalName


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Wed Apr 07, 2004 5:51 pm    Post subject: Re: Specifying Client IP Address with Indy Reply with quote


"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





PostPosted: Tue Apr 20, 2004 5:37 pm    Post subject: Re: Specifying Client IP Address with Indy Reply with quote

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





PostPosted: Wed Apr 21, 2004 7:55 pm    Post subject: Re: Specifying Client IP Address with Indy Reply with quote

"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





PostPosted: Wed Apr 21, 2004 7:56 pm    Post subject: Re: Specifying Client IP Address with Indy Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.