cURL / Mailing Lists / curl-users / Single Mail

curl-users

Allow binding to a user-defined source port

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 27 Jan 2006 23:07:21 +0100 (CET)

Hi

I just read Chris Ross' response in the feedback section of the curl web site,
regarding "Allow binding to a user-defined source port"

(see http://curl.haxx.se/feedback/display.cgi?id=11380520683225&support=yes)

Since I already have some half-ready code that does the job, I decided I'd
post what I have now here and take the discussion to the list about how a
command line argument setting this would work!

IMHO, the option to set a local port number should not force the user to also
set a local IP address but should allow it too of course. Thus I find it
natural to be a separate option.

Also, since port numbers are rare and since they tend to be occupied a while
after use, there will most certainly be many cases where you want to be able
to specify a *range* of ports for libcurl to pick from. Also, if you for
example do FTP and you set the local port number, you'll get two connections
to set port number for and they need one port number each...

So, I guess my simple suggestion is "--local-port <num>[- num]". Thus, you can
set a single option or you can set a range of acceptable port numbers.

Any better/alternative ideas on how it could be done?

(The patch still uses a hardcoded local port and alas, it is not complete
yet.)

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html

Received on 2006-01-27