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 

Resolving Host And IP adress with indy 9?

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Socket)
View previous topic :: View next topic  
Author Message
qyte
Guest





PostPosted: Wed Apr 27, 2005 8:13 am    Post subject: Resolving Host And IP adress with indy 9? Reply with quote



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





PostPosted: Wed Apr 27, 2005 9:42 am    Post subject: Re: Resolving Host And IP adress with indy 9? Reply with quote




"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





PostPosted: Wed Apr 27, 2005 10:17 am    Post subject: Re: Resolving Host And IP adress with indy 9? Reply with quote



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





PostPosted: Wed Apr 27, 2005 6:36 pm    Post subject: Re: Resolving Host And IP adress with indy 9? Reply with quote


"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





PostPosted: Thu Apr 28, 2005 7:10 am    Post subject: Re: Resolving Host And IP adress with indy 9? Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Internet Socket) 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.