Questions tagged [inet-ntop]
18 questions
4
votes
2 answers
Wrong output inet_ntop
I'm trying to print an ip address from inet_ntop, but the output seems pretty weird.
The program seems to work well, I succeed to connect the socket but it print this:
H��H9�u�H�[]A\A]A^A_�ff.�
Here is my code:
#include
#include…

jehutyy
- 364
- 3
- 11
4
votes
1 answer
Windows socket programming linking error for `inet_ntop()`
Possible Duplicate:
Is there an alternative to inet_ntop / InetNtop in Windows XP?
I am newbie to socket programming. I wrote my first code and its giving a linker error. I googled for the issue but could not find a solution. So, i am trying…

user1746485
- 57
- 1
- 2
3
votes
1 answer
inet_ntop returns 0.0.0.0 in first usage
I'm trying to write server application. I want to get client's ip. My problem is with inet_ntop function. I can't get it working properly. Here is my usage :
void client_loop(uint16_t port) {
int cfd;
int socket = bind_socket(port,…

panJapa
- 113
- 1
- 2
- 6
2
votes
1 answer
inet_ntop repeatedly looping IP
I'm trying to build a tool to gather information about IP addresses based on domain names. I've been using inet_ntop to achieve this and is generally working quite well for most domains. When I try it on sites like google.com or amazon.com the same…

dlismore
- 158
- 1
- 7
2
votes
2 answers
Convert result of inet_ntop to string
How can I convert the return of the function inet_ntop (const char *) to string?
The code:
string ip = inet_ntop(b->ifa_addr->sa_family,tempAddrPtr,addressOutputBuffer, sizeof(addressOutputBuffer));
always results with segfault...
struct ifaddrs…

Tomasz
- 595
- 1
- 7
- 18
1
vote
1 answer
inet_ntop provides different returns for the same ipv6 address on different platforms
On my Mac, inet_ntop produces this IPv6 address for a certain 128-bit value:
2001::53aa:64c:422:2ece:a29c:9cf6.51391
On my FC15 Linux system, I get this IPv6 address presentation:
2001:0:53aa:64c:422:2ece:a29c:9cf6.51391
My understanding is that…

vy32
- 28,461
- 37
- 122
- 246
1
vote
1 answer
RFC-recommended representation of IPv6 addresses and inet_ntop in C
Reading the RFC recommendations (RFC 5952) for how to represent IPv6 addresses in the best way, I try to implement a function in C++ that converts an array of bytes into the appropriate textual representation, i.e. std::string.
To check my code for…

huzzm
- 489
- 9
- 24
1
vote
3 answers
Delphi Tokyo 10.2.2 - Packages do not load at runtime in Win XP
I'm using the new Delphi Tokyo 10.2.2 and, in my case, I use packages loaded at runtime.
Even making a simple example and requesting EXE to load only the RTL unit occurs a run-time error, only on the Windows XP operating system:
The procedure entry…

Zoe Tecnologia
- 53
- 7
0
votes
1 answer
How to handle inet_ntop() failure?
First of all, my code example:
cout << "bla1" << endl;
struct addrinfo hints, *info;
int status;
memset(&hints, 0, sizeof hints);
char ip4[INET_ADDRSTRLEN];
char ip6[INET6_ADDRSTRLEN];
hints.ai_family = AF_INET;
hints.ai_socktype =…

milanseitler
- 765
- 1
- 7
- 21
0
votes
1 answer
can we pass unsigned char to inet_ntop()
#include
char buf[INET6_ADDRSTRLEN] = {};
int af = AF_INET;
unsigned char addr[4] = {0x7f, 0x0, 0x0, 0x1};
printf("Address: %s\n", inet_ntop(af, addr, buf, sizeof buf));
Is it valid to pass unsigned char array to inet_ntop() call?…

Mark
- 6,052
- 8
- 61
- 129
0
votes
1 answer
Duplicate calling inet_ntop() function
Please help me! I need to translate (or convert) domain names (for example google.com) to IP address. For that purpose I have found code on interet, which work perfectly, but I don't understand, why there is called function inet_ntop() two times.…

Petr Marek
- 59
- 1
- 7
0
votes
1 answer
inet_ntop cause Segmentation fault
I have problem. I have code where I need to convert domain name to IP. For that purpose I am using function getaddrinfo(). But it seems, that when I call another function (AFTER GETADDRINFO()), that my program falls (getaddrinfo return error and…

Petr Marek
- 59
- 1
- 7
0
votes
0 answers
inet_ntop doesn't return proper ip address
I need to get the ip address of api.openweathermap.org.
This is what I tried:
const char *host = strtok(url_data_string,"/"); // an IP address or a hostname, like "www.google.com" by itself
struct addrinfo hints = {0};
hints.ai_family =…

Aintsmartenough
- 59
- 1
- 8
0
votes
0 answers
inet_ntop not returning the correct value
I am at a loss here. I have inserted an IP address into a MySql table using inet_pton in a binary(16) column and when I try and retrieve it using inet_ntop I get a weird result
it displays: 23a6::
It should display: 35.166.0.0
$Results =…

user3098629
- 175
- 1
- 1
- 13
0
votes
1 answer
Print my ip TCP server C
I'm writing a two way chat in C, but what I'd really like to do is have the chat server print the ip of the host when it starts up. My code thus far looks like this:
#include…

tadamhicks
- 905
- 1
- 14
- 34