Greetings,
if I grasp the FTP protocol (RFC959) correctly, in active mode with default settings, the server establishes the data connections from its port 20 to the ip/port client has connected from.
Could someone please explain to me how this actually works with multiple clients? ( or tell me where I got it wrong )
To be more specific lets say I:
1) call socket()
2) bind()
the descriptor to my ip/port 20
3) connect()
the client to establish the data connection
meanwhile in another thread handling a different client i attempt to do the same
the bind()
call will fail for obvious reasons.
I am aware that you can use setsockopt() with SO_REUSEADDR to let sockets bind to the same address/port, but are packets going to be delivered properly? I am quite lost.
I wasn't able to find anything on this matter so far, so any help would be greatly appreciated.