CAsyncSocket and IP 
Author Message
 CAsyncSocket and IP

 I am trying to get my little test application
to display the IP address of the machine it
is running on. I have it up and running to
a point where I can accept connections
from a client no problem. But when I run
it in server mode I want it to display the
internet IP for the user so he could in theory
call his buddy and say "connect to this address"

I saw there was a function err method (I'm a newbie)
of CAsyncSocket::GetSocketName. But when I tested
it out it just displayed , thats not my IP.
Is there an easy way? And please don't say "forget
CAsyncSocket use the berkly sockets" or somesuch.
I need learn one thing at a time.

I wanted to add that I did a search on the newsgroups and
saw many people had simular questions that got answered
with try GetHostName() followed by GetHostByName()
which I tryed in my newbie test app. But I ran into a problem
char[1024] name=GetHostByName(variable containing hostname)->h_name;
worked fine but that only returned my computers name, not the ip
someone would need to connect to the application over the net.
So i tryed the
char[1024] name=GetHostByName()->h_addr_list;
as well as h_addr
this gave me errors about the operator = so I looked up what h_addr_list
was, It turn out it is of type char **, I have never seen that in all my
newbie days. I understand what a char * is, but two *s?
So I looled it up on my msdn cd. and ended up with char *Far *Far or
somesuch what the heck is it and how can i get the output converted
into a CString so I can display it?

Sun, 14 Sep 2003 16:26:16 GMT  
 [ 1 post ] 

 Relevant Pages 

1. CAsyncSocket and IP

2. Why CASyncSocket TCP/IP client lose data?

3. ip configuration and the CAsyncSocket object

4. Network local IP address with CAsyncSocket object

5. IP Address and CAsyncSocket

6. Local connection using CAsyncSocket and TCP/IP?

7. Problem with TCP/IP and MFC-Class CAsyncSocket

8. CAsyncSocket and TCP/IP registry entries

9. getting ip address of the default route interface (public ip vs private ip)

10. Doubt : after getc(ip) how to decrement ip FILE pointer

11. pcap ip->ip_src and ip->ip_dst (are the same) problem

12. how to find the IP (WAN IP)


Powered by phpBB® Forum Software