cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: TCP port# for HTTP

From: Nick Zitzmann <nick_at_chronosnet.com>
Date: Wed, 7 Nov 2012 11:14:03 -0700

On Nov 7, 2012, at 8:56 AM, "ABULIUS, MUGUR (MUGUR)" <mugur.abulius_at_alcatel-lucent.com> wrote:

> Hello,
> I am new a libcurl programmer and I have a simple question about the example at: http://curl.haxx.se/libcurl/c/simple.html.
>
> 1) Which TCP port# is used by the HTTP request in this example?

If it's not explicitly stated, then it is the default port number. RFC 2616, which is the spec for HTTP 1.1, says that the default HTTP port is port 80.

> 2) Is this TCP port# coming from “/etc/services”?

No.

> 2) There is any way to specify an external parameter (e.g.. environment variables or configuration file) to allow 2 different running instances of this same “simple.c” program to use different TCP ports for the HTTP request?

Of course. You could read one in from the arguments passed into the program as well. Just plug it into the URL, or set the option CURLOPT_PORT.

Nick Zitzmann
<http://www.chronosnet.com/>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-11-07