Reputation: 859
I'm going to develop a FTP client between two machines which due to security reasons there is a restrict firewall between them. The firewall only accept connections to already defined ports on both server and client and there is no possibility to open a port range. But I can not bind my client and server to negotiate with specific ports. For example I always want to upload one file from port 50000 on my local to port 21 on the FTP server. How I can achieve this goal?
Upvotes: 1
Views: 1209
Reputation: 129
Use connect
method overload that takes localPort
parameter (the method is inherited from SocketClient
:
public void connect(InetAddress host, int port,
InetAddress localAddr, int localPort)
Pay attention to localAddr
if you have more the one IP assigned.
Upvotes: 1