Limit socket connection to local machine

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

What is the best way to limit a socket connect to the local machine

Is this correct & best way to do this?

mySocket = s.Accept();
if(mySocket.LocalEndPoint != mySocket.RemoteEndPoint)
mySocket.Close();



Bob
 
Hello, Bob!

if you want to only accept local connections, then you can bind socket to
local endpoint ( loopback ).

socket.Bind(new IPEndPoint(IpAddress.Loopback, somePort));

You wrote on Mon, 23 Oct 2006 12:58:06 -0400:

B> What is the best way to limit a socket connect to the local machine

B> Is this correct & best way to do this?

B> mySocket = s.Accept();
B> if(mySocket.LocalEndPoint != mySocket.RemoteEndPoint)
B> mySocket.Close();



B> Bob
 
Back
Top