LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading the client IP address in RESTfull web service

Solved!
Go to solution

Is it possible to read the IP address of the client accessing a RESTfull webservice built in LV? For example, one might want to identify users from local IP addresses and output different information.

CLED (2016)
0 Kudos
Message 1 of 7
(4,020 Views)

InfiniteNothing,

 

Hello! Though I'm no expert at webservices, I'm pretty sure the only way for you to get the IP address of the client accessing your webservice is for the client to send it as part of the call to the webservice itself. I hope this helps!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ben Sisney
FlexRIO V&V Engineer
National Instruments
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 Kudos
Message 2 of 7
(3,996 Views)

In a case like the weather service it would require that the user knew their IP address and wouldn't lie. I'd rather I could do this from the server side.

CLED (2016)
0 Kudos
Message 3 of 7
(3,992 Views)

InfiniteNothing,

 

I see your point! I did not intend to say that the user would providing the IP address via manual entry. What I was trying to say was that your Thin Client program should have the ability to obtain the IP address of the user that accesses it and send that information to your LabVIEW Webservice.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ben Sisney
FlexRIO V&V Engineer
National Instruments
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 Kudos
Message 4 of 7
(3,973 Views)

In a case like the weather station example, there is no thin client. The web service is accessed directly. 

CLED (2016)
0 Kudos
Message 5 of 7
(3,969 Views)

InfiniteNothing,

 

Ah, Yes, Looking at that example I see what you are saying. My understanding is that the typical/suggeted use case for webservices is to have a thin client that makes the calls to the webservice instead of the user making the call like the weather station example does. I'll keep looking to verify that you can/can't get the IP address from the webservice itself.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ben Sisney
FlexRIO V&V Engineer
National Instruments
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
0 Kudos
Message 6 of 7
(3,942 Views)
Solution
Accepted by topic author InfiniteNothing

InfiniteNothing,

 

Allright, I think I've found somthing.

 

Among the Web Wervices VIs, there is a VI called Read Request Variable. One of the variables that you can read is Remote Address and I think this will give you the IP Address. To use these VIs you'll have to use the streaming method of getting data instead of reading terminals (as the example does).

 

I hope this helps!

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ben Sisney
FlexRIO V&V Engineer
National Instruments
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Message 7 of 7
(3,935 Views)