Exception in calling Socket.Accept
-
Hi I am trying to create a socket for listening form my machine as a server. Could somebody tell me why there is an exception "An invalid argument was supplied" in the last line below? IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); IPAddress ipAddress = ipHostInfo.AddressList[0]; IPEndPoint localEndPoint = new IPEndPoint(ipAddress,myPort); Socket listener = new Socket(AddressFamily.InterNetwork, aSocketType.Stream, ProtocolType.Tcp); listener.Bind(localEndPoint); Socket acceptedSocket=listener.Accept(); Thanks Ela
-
Hi I am trying to create a socket for listening form my machine as a server. Could somebody tell me why there is an exception "An invalid argument was supplied" in the last line below? IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); IPAddress ipAddress = ipHostInfo.AddressList[0]; IPEndPoint localEndPoint = new IPEndPoint(ipAddress,myPort); Socket listener = new Socket(AddressFamily.InterNetwork, aSocketType.Stream, ProtocolType.Tcp); listener.Bind(localEndPoint); Socket acceptedSocket=listener.Accept(); Thanks Ela