Good suggestion. Port=0 => bind any port, Port=-1 => bind no port. Seems to fit in rather nicely.
/ Marcus Comstedt (ACROSS) (Hail Ilpalazzo!)
Previous text:
2003-04-24 01:29: Subject: Re: IPv6 diff for Pike 7.5.7 (today's snapshot)
On Thu, Apr 24, 2003 at 01:20:01AM +0200, Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum scribbled: [snip]
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.
In the current code indeed.
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...
Indeed. We could also use -1 for the first argument to make the special case, I guess.
marek
/ Brevbäraren