Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-03

getaddrinfo

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

MegaBrutal

Hi all,

I'm working on an cross-platform application with DNS resolution with IPv6 support, but I can't really get around how should I handle IP version independent DNS resolution. After some searching, I see getaddrinfo might be a convenient solution, since it is implemented on multiple platforms, as it is POSIX-standard. Windows and Linux both have it.

Which unit should I link on Windows and Linux to get getaddrinfo? On Linux, I managed to link it through cnetdb, though probably there is a better way. On Windows, I tried Windows, WinSock and WinSock2, but neither has it.

I also need some help with using the function, as it works very strangely on Linux, as it returns addrinfo structures, but the ai_addr member is always a null-pointer, which is theoretically impossible by the manual, in my understanding.

Though if you have a better idea for cross-platform and IP version independent network handling with Free Pascal, I'm all ears!

~MegaBrutal

Reply by email

MegaBrutal
to MegaBrutal

Hi,

Can anyone help me with this?

2015-03-20 4:14 GMT+01:00 MegaBrutal :

Show quoted text 25 lines
Hi all, I'm working on an cross-platform application with DNS resolution with IPv6 support, but I can't really get around how should I handle IP version independent DNS resolution. After some searching, I see getaddrinfo might be a convenient solution, since it is implemented on multiple platforms, as it is POSIX-standard. Windows and Linux both have it. Which unit should I link on Windows and Linux to get getaddrinfo? On Linux, I managed to link it through cnetdb, though probably there is a better way. On Windows, I tried Windows, WinSock and WinSock2, but neither has it. I also need some help with using the function, as it works very strangely on Linux, as it returns addrinfo structures, but the ai_addr member is always a null-pointer, which is theoretically impossible by the manual, in my understanding. Though if you have a better idea for cross-platform and IP version independent network handling with Free Pascal, I'm all ears! ~MegaBrutal

Reply by email

Mark Morgan Lloyd
to MegaBrutal

Top-posting moved. Please don't.

MegaBrutal wrote 27 lines
2015-03-20 4:14 GMT+01:00 MegaBrutal : > Hi all, > > I'm working on an cross-platform application with DNS resolution with > IPv6 support, but I can't really get around how should I handle IP > version independent DNS resolution. After some searching, I see > getaddrinfo might be a convenient solution, since it is implemented on > multiple platforms, as it is POSIX-standard. Windows and Linux both > have it. > > Which unit should I link on Windows and Linux to get getaddrinfo? On > Linux, I managed to link it through cnetdb, though probably there is a > better way. On Windows, I tried Windows, WinSock and WinSock2, but > neither has it. > > I also need some help with using the function, as it works very > strangely on Linux, as it returns addrinfo structures, but the ai_addr > member is always a null-pointer, which is theoretically impossible by > the manual, in my understanding. > > Though if you have a better idea for cross-platform and IP version > independent network handling with Free Pascal, I'm all ears! Hi, Can anyone help me with this?

I don't know to what extent the core developers are using IP6, so there's always a possibility that there are undetected problems.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Ewald
to MegaBrutal: I'm working on an cross-platform application with DNS resolution with IPv6 support, but I…
MegaBrutal wrote
I also need some help with using the function, as it works very strangely on Linux, as it returns addrinfo structures, but the ai_addr member is always a null-pointer, which is theoretically impossible by the manual, in my understanding.

As Mark suggested, perhaps a bug in the fpc implementation (fpc does not normally use lic for it's syscalls)? Try defining the function manually, using libc's equivalent and see if it produces the same result?

Just a suggestion...

Ewald

Reply by email

Mark Morgan Lloyd
to Ewald
Ewald wrote 9 lines
On 03/20/2015 04:14 AM, MegaBrutal wrote: > I also need some help with using the function, as it works very > strangely on Linux, as it returns addrinfo structures, but the ai_addr > member is always a null-pointer, which is theoretically impossible by > the manual, in my understanding. As Mark suggested, perhaps a bug in the fpc implementation (fpc does not normally use lic for it's syscalls)? Try defining the function manually, using libc's equivalent and see if it produces the same result?

The only context I've looked at that in was a server program which under some circumstances reported the address of an IP4 client formatted as IP6. It wouldn't be easy for me to get back into that at the moment, but I reported an ordering problem (Mantis 22605) and had my concerns partly allayed.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email