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

Re: Limit socket connection to local machine by Vadym

Vadym
Mon Oct 23 14:06:59 CDT 2006

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



--
With best regards, Vadym Stetsyak.
Blog: http://vadmyst.blogspot.com