CURLOPT_FTPPORT.3 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2017, 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.haxx.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. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_FTPPORT 3 "May 30, 2017" "libcurl 7.61.1" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_FTPPORT \- make FTP transfer active
  26. .SH SYNOPSIS
  27. #include <curl/curl.h>
  28. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTPPORT, char *spec);
  29. .SH DESCRIPTION
  30. Pass a pointer to a zero terminated string as parameter. It specifies that the
  31. FTP transfer will be made actively and the given string will be used to get
  32. the IP address to use for the FTP PORT instruction.
  33. The PORT instruction tells the remote server to connect to our specified IP
  34. address. The string may be a plain IP address, a host name, a network
  35. interface name (under Unix) or just a '-' symbol to let the library use your
  36. system's default IP address. Default FTP operations are passive, and thus
  37. won't use PORT.
  38. The address can be followed by a ':' to specify a port, optionally followed by
  39. a '-' to specify a port range. If the port specified is 0, the operating
  40. system will pick a free port. If a range is provided and all ports in the
  41. range are not available, libcurl will report CURLE_FTP_PORT_FAILED for the
  42. handle. Invalid port/range settings are ignored. IPv6 addresses followed by
  43. a port or portrange have to be in brackets. IPv6 addresses without port/range
  44. specifier can be in brackets.
  45. Examples with specified ports:
  46. .nf
  47. eth0:0
  48. 192.168.1.2:32000-33000
  49. curl.se:32123
  50. [::1]:1234-4567
  51. .fi
  52. You disable PORT again and go back to using the passive version by setting
  53. this option to NULL.
  54. The application does not have to keep the string around after setting this
  55. option.
  56. .SH DEFAULT
  57. NULL
  58. .SH PROTOCOLS
  59. FTP
  60. .SH EXAMPLE
  61. .nf
  62. CURL *curl = curl_easy_init();
  63. if(curl) {
  64. curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/old-server/file.txt");
  65. curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
  66. ret = curl_easy_perform(curl);
  67. curl_easy_cleanup(curl);
  68. }
  69. .fi
  70. .SH AVAILABILITY
  71. Port range support was added in 7.19.5
  72. .SH RETURN VALUE
  73. Returns CURLE_OK if the option is supported, CURLE_UNKNOWN_OPTION if not, or
  74. CURLE_OUT_OF_MEMORY if there was insufficient heap space.
  75. .SH "SEE ALSO"
  76. .BR CURLOPT_FTP_USE_EPRT "(3), " CURLOPT_FTP_USE_EPSV "(3), "