Create Socket Error

  • Thread starter Thread starter Anony
  • Start date Start date
A

Anony

Hi All,

I'm trying to create a listener server:

IPAddress ipAddress = IPAddress.Parse("192.168.0.1");
IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 9999);

Socket listener = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp );

Before Bind and Listen, I get exception at the Socket:

An unhandled exception of type
'System.Configuration.ConfigurationException' occurred in system.dll

Additional information: Unrecognized attribute 'value'

What's wrong with 'System.Configuration' ?
Thanks for any tip or fix.


Kind regards,
Anony
 
This seemed to work over here. Might check 192.168.0.1 is ok on your system
and port 9999 is free (however you should have gotten different exception I
think). Is this a virtual nic or something?

IPAddress ipAddress = IPAddress.Parse("192.168.0.221");
IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 9999);

Socket listener = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp );
listener.Bind(localEndPoint);
Console.WriteLine("Did Bind.");
listener.Listen(100);
 
Back
Top