we have client server application generated by ibm visualage smalltalk 5.5
How can we know the computer name or ip address for client ( in run time )
thank you
Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig
hostName := SciSocketManager default getHostName.
hostAddress := SciSocketManager default getHostByName: hostName
SciSocketManager default getHostName
| sciSocket sciSocketAddress aSciHostEnt remoteHostname |
sciSocketAddress := sciSocket getPeerName.
aSciHostEnt := SciSocketManager default getHostBySockName: sciSocketAddress.
remoteHostname := aSciHostEnt name
Hans-Martin wrote:Note that for multi-homed hosts, the hostAddress object may contain more than one IP address, it's up to your application to decide which one you want to use.
public static IPAddress MainIPv4Address(IPHostEntry hostEntry)
{
foreach (IPAddress eachAddress in hostEntry.AddressList)
{
if (eachAddress.AddressFamily == AddressFamily.InterNetwork)
return (eachAddress);
}
return null;
}
Return to VA Smalltalk 7.0, 7.5 & 8.0
Users browsing this forum: Yahoo [Bot] and 1 guest