CURLOPT_PORT.3 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_PORT 3 "17 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_PORT \- remote port number to connect to
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PORT, long number);
  32. .fi
  33. .SH DESCRIPTION
  34. We discourage using this option since its scope is not obvious and hard to
  35. predict. Set the preferred port number in the URL instead.
  36. This option sets \fInumber\fP to be the remote port number to connect to,
  37. instead of the one specified in the URL or the default port for the used
  38. protocol.
  39. Usually, you just let the URL decide which port to use but this allows the
  40. application to override that.
  41. While this option accepts a 'long', a port number is an unsigned 16 bit number
  42. and therefore using a port number lower than zero or over 65535 will cause a
  43. \fBCURLE_BAD_FUNCTION_ARGUMENT\fP error.
  44. .SH DEFAULT
  45. By default this is 0 which makes it not used. This also makes port number zero
  46. impossible to set with this API.
  47. .SH PROTOCOLS
  48. Used for all protocols that speak to a port number.
  49. .SH EXAMPLE
  50. .nf
  51. CURL *curl = curl_easy_init();
  52. if(curl) {
  53. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/foo.bin");
  54. curl_easy_setopt(curl, CURLOPT_PORT, 8080L);
  55. ret = curl_easy_perform(curl);
  56. curl_easy_cleanup(curl);
  57. }
  58. .fi
  59. .SH AVAILABILITY
  60. Always
  61. .SH RETURN VALUE
  62. Returns CURLE_OK
  63. .SH "SEE ALSO"
  64. .BR CURLOPT_STDERR "(3), " CURLOPT_DEBUGFUNCTION "(3), "