Do I have access to the IP addresses of any client that is currently running on the network somewhere, i.e. the clients that show up on the gateway status page? I am creating a network status screen for my other devices, and thought I’d include the clients too. I know I could have each client set a value in the database when it’s launched, but if the information is already there somewhere, I’d use that instead.
You can use
Check out the user manual. The sample code there works great to display all users and IP address, projects running ect.
Outstanding! I knew it had to be there somewhere. Thanks for the tip.
Ok, I’m seeing something odd. I have four different client apps running from the gateway (three are on the gateway PC, and I have another client app running on three other client PCs). Let’s say Projects A, B and C are running on the gateway PC, and Project D is running on the client PCs, for a total of six client apps. The getSessionInfo code is being called from Project A, and the results are stored in a table.
But when I call getSessionInfo, it returns a list of all of the individual clients as it should, they each have a unique ClientID, and the IP addresses are correct, but the project name is the same for all of them (Project A). I could swear that it returned the actual project names when I tested this the other day, but all I’m seeing now is Project A for everything. I tried stripping out the code that stores it in a table in the database and instead pass the results directly to a table on the screen, but I get the same results. Shouldn’t I get the actual project names in this result set?
You’re right, this was a bug in getSessionInfo. It has been fixed for 7.1.4.
As long as you are making a change anyway, would it be a big deal to include the running time of the session as well? It is dislayed on the gateway status screen, so I assumed it was available.
How would you want this returned, a Date representing the creation time of the session (e.g. 2010-07-03 08:23:44), or a String representing the running time (e.g. “5 hours, 3 minutes”) ?
I think the creation time would be the best. I can key off that to display other values.
Has the IP address been removed from system.util.getSessionInfo()?
In 7.9 I am seeing a host name but not an IP address in the address column. Is there another function to return IP addresses for all connected clients?
The IP address is still listed in the documentation, and I don’t think Inductive usually removes functionality, so I would guess the info is still there.
You could try using system.net.getIpAddress
See the Scripting Function list in the Docs:
Where you you see this?
All I see in the documentation is the “address” which is usually the hostname. Nothing has changed with regards to this method.
hm. That is what it says. “Address” not “IP Address.” However the documentation doesn’t clarify that “Address” is usually a hostname. That seems a little confusing, especially when earlier in this thread Step7 was saying that he got IPs from the function.
Thanks for teaching me something.