HELP : SocketException 10049

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top