[fpc-pascal] fpbind ipv6 version
Rainer Stratmann
rainerstratmann at t-online.de
Mon Oct 28 14:52:13 CET 2019
On Sonntag, 27. Oktober 2019 10:32:11 CET Michael Van Canneyt wrote:
> On Sat, 26 Oct 2019, Rainer Stratmann wrote:
> > https://www.freepascal.org/docs-html/current/rtl/sockets/fpbind.html
> >
> > Is there an example for IPV6?
> >
> > function fpbind(
> >
> > s: cint;
> > addrx: psockaddr;
> > addrlen: TSockLen
> >
> > ):cint;
> >
> > I guess psockaddr is different in IPV6 version.
>
> No, it does not have to be..
> The addrlen will differ of course. That's why it is there to begin with.
> Maybe an overload could be added, I would need to look into this to see if
> it is required.
I wrote an http server on my own. It works a long time already with IPv4.
For the IPV6 version I changed psockaddr to sockaddr_in6.
And the proper addrlen -> sizeof( sockaddr_in6 );
I discovered that shortly after my first question about this topic here in the
mailinglist.
Additionally the socket protocol family was changed from PF_INET to PF_INET6
when creating the socket.
Also I have to change fpaccept the same way as fpbind.
The server then worked properly with a localhost IPV6 request from a browser
[::1]
FPC 2.6.4
> Michael.
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list