quickjs-tart

quickjs-based runtime for wallet-core logic
Log | Files | Refs | README | LICENSE

CURLOPT_FTPPORT.md (2761B)


      1 ---
      2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
      3 SPDX-License-Identifier: curl
      4 Title: CURLOPT_FTPPORT
      5 Section: 3
      6 Source: libcurl
      7 Protocol:
      8   - FTP
      9 See-also:
     10   - CURLOPT_FTP_USE_EPRT (3)
     11   - CURLOPT_FTP_USE_EPSV (3)
     12 Added-in: 7.1
     13 ---
     14 
     15 # NAME
     16 
     17 CURLOPT_FTPPORT - make FTP transfer active
     18 
     19 # SYNOPSIS
     20 
     21 ~~~c
     22 #include <curl/curl.h>
     23 
     24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FTPPORT, char *spec);
     25 ~~~
     26 
     27 # DESCRIPTION
     28 
     29 Pass a pointer to a null-terminated string as parameter. It specifies that the
     30 FTP transfer should be made actively and the given string is used to get the
     31 IP address to use for the FTP PORT instruction.
     32 
     33 The PORT instruction tells the remote server to do a TCP connect to our
     34 specified IP address. The string may be a plain IP address, a hostname, a
     35 network interface name (under Unix) or just a '-' symbol to let the library
     36 use your system's default IP address. Default FTP operations are passive, and
     37 does not use the PORT command.
     38 
     39 The address can be followed by a ':' to specify a port, optionally followed by
     40 a '-' to specify a port range. If the port specified is 0, the operating
     41 system picks a free port. If a range is provided and all ports in the range
     42 are not available, libcurl reports CURLE_FTP_PORT_FAILED for the
     43 handle. Invalid port/range settings are ignored. IPv6 addresses followed by a
     44 port or port range have to be in brackets. IPv6 addresses without port/range
     45 specifier can be in brackets.
     46 
     47 Examples with specified ports:
     48 
     49     eth0:0
     50     192.168.1.2:32000-33000
     51     curl.se:32123
     52     [::1]:1234-4567
     53 
     54 We strongly advise against specifying the address with a name, as it causes
     55 libcurl to do a blocking name resolve call to retrieve the IP address. That
     56 name resolve operation does **not** use DNS-over-HTTPS even if
     57 CURLOPT_DOH_URL(3) is set.
     58 
     59 Using anything else than "-" for this option should typically only be done if
     60 you have special knowledge and confirmation that it works.
     61 
     62 The application does not have to keep the string around after setting this
     63 option.
     64 
     65 Using this option multiple times makes the last set string override the
     66 previous ones. You disable PORT again and go back to using the passive version
     67 by setting this option to NULL.
     68 
     69 # DEFAULT
     70 
     71 NULL
     72 
     73 # %PROTOCOLS%
     74 
     75 # EXAMPLE
     76 
     77 ~~~c
     78 int main(void)
     79 {
     80   CURL *curl = curl_easy_init();
     81   if(curl) {
     82     CURLcode res;
     83     curl_easy_setopt(curl, CURLOPT_URL,
     84                      "ftp://example.com/old-server/file.txt");
     85     curl_easy_setopt(curl, CURLOPT_FTPPORT, "-");
     86     res = curl_easy_perform(curl);
     87     curl_easy_cleanup(curl);
     88   }
     89 }
     90 ~~~
     91 
     92 # %AVAILABILITY%
     93 
     94 # RETURN VALUE
     95 
     96 curl_easy_setopt(3) returns a CURLcode indicating success or error.
     97 
     98 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see
     99 libcurl-errors(3).