majidpics
12-22-2002, 10:46 AM
I am in linux using gcc
I want to print my ip address
I am doing this
my_addr.sin_family=AF_INET;
my_addr.sin_port=1234;
my_addr.sin_addr.s_addr=htonl(INADDR_ANY);
but when i print the address like
printf("%s",inet_ntoa(my_addr.sin_addr));
it prints
0.0.0.0
what should i do.
It will be better if you reply with example. Thankx
I want to print my ip address
I am doing this
my_addr.sin_family=AF_INET;
my_addr.sin_port=1234;
my_addr.sin_addr.s_addr=htonl(INADDR_ANY);
but when i print the address like
printf("%s",inet_ntoa(my_addr.sin_addr));
it prints
0.0.0.0
what should i do.
It will be better if you reply with example. Thankx