Q:

Socket.Accept() method is blocking when receiving FTP active mode data connection

Not sure if the partial code below will help but we are having an issue which only happens in a few of our client machines trying to FTP data to the FTP server.
We are taking network traces and trying to find anything unique about these machines. 
Here is where our code stops: => listening_sock.Accept();
//region Try to bind to an available data port
System.Net.IPEndPoint localEP = new IPEndPoint(IPAddress.Parse(sIPAddr), (dataPortStart == 0 ? 0 : GetFreePort(dataPortStart, dataPortEnd)));
listening_sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
listening_sock.Bind(localEP);
Log.WriteLine("Listening sock bound to IP Address:" + localEP.Address.ToString() + " on port " + localEP.Port.ToString());

//port 20
if (data_sock != null)      // already connected (always so if passive mode)
return;

data_sock = listening_sock.Accept();    // Accept is blocking
listening_sock.Close();
listening_sock = null;

Here we can see the send port command was successful (Active FTP) but server responds with a 425:

My best bet is Firewall. I am checking that too.
Thank you

A:

The Socket is created blocking by default. So the Socket.Accept should indeed block until a connection request is received.
I assume the problem is not in the code, but the request actually does not come, either because:

it is blocked by a firewall
or you have NAT configured incorrectly
or you have provided a wrong IP address or port number to the server.

