HELP : SocketException 10049

  • Thread starter Thread starter Alessandro
  • Start date Start date
A

Alessandro

Hi,
I can't figure out why this code gives me
the SocketException with ErrorCode 10049
when Bind method is called.

Notes:
1)I have no Firewall and I can reach all servers on the
Internet.

2) In my code the member this.m_sRemoteHost is the correct IP address
of the server I want to connect to.

Does anyone have some hint ?

---------------------------------------------------------------------------
// create listening socket at a system allocated port
Socket sock = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
//first resolve remote host IP
IPAddress endAddress=Dns.Resolve(this.m_sRemoteHost).AddressList[0];
// choose any port for the new given end point
IPEndPoint endPoint = new IPEndPoint(endAddress, 0);
try
{
sock.Bind(endPoint);
// queue up to 5 connections
sock.Listen(5);
}


Regards
Alessandro
 
Back
Top