简体   繁体   中英

Listening to specific ip address

I trying to listen to the ip address 10.100.102.3 , but VS 2013 throws an error:

"The requested address is not valid in this context".

My ip address is 10.100.102.7.

Code :

IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Parse("10.100.102.3"), Port);

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

listener.Bind(localEndPoint);
listener.Listen(100);
Receiver = listener.Accept();

You cannot listen to a specific address people send from . The address you gave has to be an address that people can send to .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM