Well, yeah.
Pike v7.5 release 7 running Hilfe v3.5 (Incremental Pike Frontend)
Stdio.File f = Stdio.File(); f->connect("::1", "ftp");
(1) Result: 1
f->query_address();
(2) Result: "::1 21"
f->query_address(1);
(3) Result: "::1 4396"
I expect we'll still need a way to specific protocol family when calling open_socket() directly though, since open_socket() can be used to create the socket without actually disclosing either target or destination address yet. The question is how to specify it. Mareks patch adds a third argument, which seems like the logical choice at first, however it has undesired side effects:
f->open_socket(0,0);
binds the socket to any port on any interface, while
f->open_socket();
creates the socket _without_ binding it. By making the family the third argument, it becomes impossible to specify the family without binding the socket.
We could of course say that if the third argument is given, the first two are disregarded and the socket is not bound, since it's possible to bind the socket manually with a call to ->bind() afterwards if so desired. But having two dummy arguments isn't very nice either...
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-04-23 23:03: Subject: Re: IPv6 diff for Pike 7.5.7 (today's snapshot)
To me, it seems a lot cleaner to just give it an address, and have the code examine the address to figure out which address family it is.
That's how it works now after Marcus Comstedts latest changes, I believe.
/ Martin Nilsson (har bott i google)