title: How to start active mode for FTP client in C, linux
body: <p>I have to write a little command line FTP client for linux in C. It works quite well for common uses (directory managing, retrieving and storing files, etc.), and I want to add the active mode (at the moment every transfer is made under passive mode).<br>
  I know that I have to send a command in the shape of :</p>
  
  <pre><code>PORT a,b,c,d,e,f
  </code></pre>
  
  <p>where <code>a b c d</code> are the ip address blocks and <code>e f</code> the port numbers. However, as I understand it, the ip has to be the ip of the machine on which my client is running, but I've been advised to use <code>getsockname()</code>. From what I've tested, <code>getsockname()</code> gets me the local ip of the interface(s) used by my socket, not my ip seen from the internet. So I can't give this ip address for the server to connect.</p>
  
  <p>The question is : am I understanding the command <code>PORT</code> correctly, and how to get the correct ip to send it ?</p>