MOO-cows Mailing List Archive


Re: IP # from connection_name?

> > > is there a way to pull the actual connection ip number from one
> > > of the net commands? My connection_name() returns the machine name,

> Actually, I've seen and worked a little bit with an in-db solution to 
> this...there's an object floating around there called $resolver which has 
> functions that return all that sorta useful stuff, make DNS calls, etc.

I changed my connection_name() to return strings like this:

"port 3200 from localhost (, port 1032"

This is probably a better solution. The server already hangs looking up the
hostname from the IP when the connection occurs. So it already has the IP and
just doesn't tell it to you. You'd have it hang again waiting for
open_network_connection() with an in-db solution like $resolver. Plus some
hostnames map to multiple IPs so you might not get the IP the connection came
from. It also makes use of the operating system's hostname cache so might
might not need to do a lookup every time.

Although I don't use LambdaCore, I don't think it would break things cuz you
could suitably change $string_utils:connection_hostname_bsd().

Or adding a connection_option() for it wouldn't break anything.

It would be very nice if the server wouldn't hang during name lookups
especially since another process does them anyway. Or if
open_network_connection() could suspend. =8-)



Home | Subject Index | Thread Index