| View previous topic :: View next topic |
| Author |
Message |
qyte Guest
|
Posted: Wed Apr 27, 2005 8:13 am Post subject: Resolving Host And IP adress with indy 9? |
|
|
I am using IdTCP in an app to connect two
instances of a program.
is there a way of finding out both
RemoteHost and RemoteAddress of the other
side of the peer?
I found that IdTCP->Socket->binding->IP
gets either the ip address or the host.
How can i resolve both of them?
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Apr 27, 2005 9:42 am Post subject: Re: Resolving Host And IP adress with indy 9? |
|
|
"qyte" <gyte (AT) vivodinet (DOT) gr> wrote
| Quote: | is there a way of finding out both RemoteHost and
RemoteAddress of the other side of the peer?
|
Yes.
| Quote: | I found that IdTCP->Socket->binding->IP
gets either the ip address or the host.
|
You need to use the PeerIP instead:
AnsiString IP = IdTCP->Socket->Binding->PeerIP;
AnsiString Host = GStack->WSGetHostByAddr(IP);
Gambit
|
|
| Back to top |
|
 |
qyte Guest
|
Posted: Wed Apr 27, 2005 10:17 am Post subject: Re: Resolving Host And IP adress with indy 9? |
|
|
Remy Lebeau (TeamB) wrote:
| Quote: | You need to use the PeerIP instead:
AnsiString IP = IdTCP->Socket->Binding->PeerIP;
AnsiString Host = GStack->WSGetHostByAddr(IP);
|
I have already done that and it works.
another problem that i found was that
if i connect the two programs from the same
computer but using my internet IP address
they connect and the ip address is also correct
but the host is my computer name.
can i solve this somehow?
i haven't tried connecting to another pc
yet and so i do not know if the same thing
will happen in such case.
I would prefer not to resolve the computer
name of the peer but it's DNS.
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Wed Apr 27, 2005 6:36 pm Post subject: Re: Resolving Host And IP adress with indy 9? |
|
|
"qyte" <gyte (AT) vivodinet (DOT) gr> wrote
| Quote: | I have already done that and it works.
|
Then why did you ask for something you already knew?
| Quote: | another problem that i found was that
if i connect the two programs from the same
computer but using my internet IP address
they connect and the ip address is also correct
but the host is my computer name.
|
As well it should be.
| Quote: | I would prefer not to resolve the computer
name of the peer but it's DNS.
|
That is what WSGetHostByAddr() is already doing.
Gambit
|
|
| Back to top |
|
 |
qyte Guest
|
Posted: Thu Apr 28, 2005 7:10 am Post subject: Re: Resolving Host And IP adress with indy 9? |
|
|
Remy Lebeau (TeamB) wrote:
| Quote: | I have already done that and it works.
Then why did you ask for something you already knew?
|
Anyway what i meant there was that i figured that
out just before you answered.
thanks anyway.
|
|
| Back to top |
|
 |
|