title: An existing connection was forcibly closed by the remote host
body: <p>I need to obtain UDP datagram from Asynchronous Socket Server but an exception occurred in my application :</p>
  
  <p>Problem appear there :</p>
  
  <pre><code>Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint);
  </code></pre>
  
  <p>The full source code:</p>
  
  <pre><code>class Program
      {
          static void Main(string[] args)
          {
              const int PORT = 30485;
              IPAddress IP;
              IPAddress.TryParse("92.56.23.87", out IP);
              // This constructor arbitrarily assigns the local port number.
              UdpClient udpClient = new UdpClient(PORT);
              Socket receiveSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
              try
              {
                  udpClient.Connect("92.56.23.87", PORT);
  
                  if (udpClient.Client.Connected)
                      Console.WriteLine("Connected.");
  
                  // Sends a message to the host to which you have connected.
                  Byte[] sendBytes = Encoding.ASCII.GetBytes("CONNECT");
  
                  udpClient.Send(sendBytes, sendBytes.Length);
  
                  //IPEndPoint object will allow us to read datagrams sent from any source.
                  IPEndPoint RemoteIpEndPoint = new IPEndPoint(IP, PORT);
  
                  // Blocks until a message returns on this socket from a remote host.
                  Byte[] receiveBytes = udpClient.Receive(ref RemoteIpEndPoint);
                  string returnData = Encoding.ASCII.GetString(receiveBytes);
                  // Uses the IPEndPoint object to determine which of these two hosts responded.
                  Console.WriteLine("This is the message you received " + returnData.ToString());
                  Console.WriteLine("This message was sent from " + RemoteIpEndPoint.Address.ToString() + " on their port number " + RemoteIpEndPoint.Port.ToString());
  
                  udpClient.Close();
  
              }
              catch (Exception e)
              {
                  Console.WriteLine(e.ToString());
  
              }
          }
      }
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>Connected.
  System.Net.Sockets.SocketException (0x80004005): An existing connection
  was forcibly closed by the remote host at System.Net.Sockets.Socket.ReceiveFrom(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, EndPoint&amp; remoteEP) at ystem.Net.Sockets.UdpClient.Receive(IPEndPoint&amp; remoteEP) at ConsoleApplication7.Program.Main(String[] args) in c:\users\user\documents\visual studio 2010\Projects\ConsoleApplication7\ConsoleApplication7\Program.cs
  </code></pre>
  
  <p>What can be the problem?</p>
  
  <hr>
  
  <p>To provide more information, i bought the private socks connection on this page: <a href="http://rapidsocks.com/">http://rapidsocks.com/</a>
  this services give me a list of IP and port who in really is not a proxy .. just a connection that give me a proxyIP:proxyPort from a pool on server in response...</p>
  
  <p>How to get that answer with proxyIP:proxyPort from the server?</p>