# Getting list of IP addresses of Sessions

**URL:** <https://forum.inductiveautomation.com/t/getting-list-of-ip-addresses-of-sessions/31572>\
**Category:** Ignition\
**Created:** [January 23, 2020, 8:42pm UTC](https://forum.inductiveautomation.com/t/getting-list-of-ip-addresses-of-sessions/31572 "2020-01-23T20:42:36Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 23, 2020, 8:42pm UTC](https://forum.inductiveautomation.com/t/getting-list-of-ip-addresses-of-sessions/31572/1 "2020-01-23T20:42:36Z")

</div>

I’m trying to get a list of the IP address in use for all open sessions of a certain project. Using `system.util.getSessionInfo()` only shows the device name, not the IP address. I currently get a list of “raspberrypi” instead.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 23, 2020, 8:47pm UTC](https://forum.inductiveautomation.com/t/getting-list-of-ip-addresses-of-sessions/31572/2 "2020-01-23T20:47:39Z")

</div>

This has come up a number of times in the past, but currently it seems intentional.

The column in the returned dataset holds the self-reported hostname the client sent when it first logged in.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 23, 2020, 8:52pm UTC](https://forum.inductiveautomation.com/t/getting-list-of-ip-addresses-of-sessions/31572/3 "2020-01-23T20:52:12Z")

</div>

Is this a security issue? Any other way to get the info?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [January 23, 2020, 8:55pm UTC](https://forum.inductiveautomation.com/t/getting-list-of-ip-addresses-of-sessions/31572/4 "2020-01-23T20:55:14Z")

</div>

I’m not sure what the reasoning on this is. Each client get use system.net.getExternalIpAddress() though.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 28, 2020, 2:41pm UTC](https://forum.inductiveautomation.com/t/getting-list-of-ip-addresses-of-sessions/31572/5 "2020-01-28T14:41:59Z")

</div>

This isn’t going to work for what I need. I have several dozen client stations that all run the same project. Each station has a static ip address. I want to monitor when each station is active along with total active etc, which I was going to do via the static IP address. Since the getSessionInfo() does not return the IP address I’m wondering what else to do.

I’ve tried writing to a tag based on logging in and logging out, but for some reason, it will miss a tag write every now and then. I will have a station or two that shows logged in, but upon inspection, the worker is logged out. Therefore the tag write did not happen.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [January 28, 2020, 3:12pm UTC](https://forum.inductiveautomation.com/t/getting-list-of-ip-addresses-of-sessions/31572/6 "2020-01-28T15:12:44Z")

</div>

Why not change the hostname of each pi to something unique?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 28, 2020, 3:22pm UTC](https://forum.inductiveautomation.com/t/getting-list-of-ip-addresses-of-sessions/31572/7 "2020-01-28T15:22:29Z")

</div>

You could always run this script as part of the Session startUp script:

```auto
import socket
device_ip = socket.gethostbyname(socket.gethostname())

```

That returns the device IP for my workstations, though I don’t have a pi to test on.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 28, 2020, 3:25pm UTC](https://forum.inductiveautomation.com/t/getting-list-of-ip-addresses-of-sessions/31572/8 "2020-01-28T15:25:15Z")

</div>

I will play with that a bit and see what happens. I like Jordan’s suggestion too. I will try both. Thanks!

**UPDATE:**  
Looks like changing the host name is the way that works best for my situation. I can’t believe I didn’t think of that. Appreciate the suggestions!
