Reputation: 1634
I am new to socket progamming and I am trying to implement a stripped down FTP like program. It uses two TCP connections, one as a control connection and other as a data connection. The problem is that I do not know how to use the sever to connect to the client's N+1 port using its port 20. Please refer here, to fund out more.
Upvotes: 0
Views: 363
Reputation: 19
You should probably go through FTP RFC 959 to get all the details. Client needs to share data port to the server if it wants server to initiate data connection.
Upvotes: 0
Reputation: 239041
To create the active mode data connection, you:
getsockname()
;socket()
;bind()
;connect()
.Note that the bind()
will likely fail if your daemon is not running as root, because binding a low port number is a privileged operation.
Upvotes: 3