Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Obtain port/IP/Machine name from remoted ojbect

Hi there.

I have several class libraries (dlls) that I host remotely.  Is there a way, on the startup of these dlls to determine the port/ip/machine name on which the object is being hosted?  I want to expose a property in these dlls that will include that information.  Right now I'm setting that property from the calling/activating object because I know what port/ip/machine the object is on, but I'd like to iterate though the objects at a later time and have them intrinsically know where they're being hosted...

thoughts?

Thanks,

Steve

No Billionaire
Monday, March 31, 2003

Can't the objects themselves, upon startup, get that information from the machine they are running on?  Is the server hosting the objects and they are being sent to the client, and then created on the client?

Tim
Wednesday, April 02, 2003

ie, Environment.MachineName etc?

Duncan Smart
Wednesday, April 02, 2003

I'm fairly new to .NET so I'm not sure how much of this information it has natively, but you could use winsock  functions (gethostname, etc) to get this information (via PInvoke or a MC++ wrapper) if you really needed it and .NET doesn't give any direct mechanism.

For most purposes I'd advise against relying on this information, though.  The IP that is configured for a local machine is very often not the IP that is used to actually contact that machine from a remote host, thanks to complex LAN setups, NATs, etc. 

George McBay
Friday, April 04, 2003

*  Recent Topics

*  Fog Creek Home