Aaron Ballman wrote:
Does anyone know of a way to limit a ServerSocket to only listen on
the loopback interface?
It's not currently possible since the loopback interface is not
reported as a network interface.
Of course, I promptly forgot to post a workaround. Doh!
In the Connected event of the socket, you can put this code:
dim remoteAddy as String = me.RemoteAddress
if remoteAddy <> "127.0.0.1" and remoteAddy <> "localhost" then
dim count as Integer = System.NetworkInterfaceCount
dim isLocal as Boolean
for i = 0 to count - 1
if remoteAddy = System.GetNetworkInterface( i ).IPAddress then
isLocal = true
next i
if not isLocal then
me.Close
return
end if
end if
Or something like that (untested code, may need some mucking around
with). The basic thought is, check in the Connected event to make
sure the connection is coming from the local machine. If it's not,
then terminate the connection. It's not as nice as binding to the
loopback interface, but it's still somewhat functional.
HTH!
~Aaron
Yeah, I have something similar to that in place already. I was hoping to
just not have it available to 'outsiders' - eliminate the possibility
for DoS attacks, etc. Will go with that for now.
Thanks again.
Ken
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>