LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically Obtain the Port of Server Running a Webservice

I'm looking for a way to programatically obtain the port used by the web server running a webservice, from within that webservice itself.

 

For instance if I have a webservice "DoStuff", and I'm running it in debug on port 8001, I want to be able to determine from withing "DoStuff" that the port in use is 8001.  Is this possible?



I saw my father do some work on a car once as a kid and I asked him "How did you know how to do that?" He responded "I didn't, I had to figure it out."
0 Kudos
Message 1 of 5
(3,225 Views)

Hi there,

 

I believe this may be somewhat what you are looking for:

 

http://digital.ni.com/public.nsf/allkb/6816DE13DCE0601986256C02007DEAA5

 

The application reference has a property -> Web Server -> HTTP Port where you can read the LabVIEW Web Services port configuration for that particular machine.

 

Hope this helps,

 

Ed

0 Kudos
Message 2 of 5
(3,160 Views)

Hello, additionally you could review the following links:

https://forums.ni.com/t5/Example-Program-Drafts/Programmatically-Change-Port-Web-Services-Are-Publis...

and

http://forums.ni.com/t5/LabVIEW/Application-Web-Server-How-to-Change-Port/td-p/3133246

These forum topics are not exactly what you need, however they work with similar functions. Look out for the Property Node and WebSrvr.Port under Application Class.

0 Kudos
Message 3 of 5
(3,151 Views)

Do you know if this only works in a published web service?  I tried this on the debug server and it only returns 0 as the port.



I saw my father do some work on a car once as a kid and I asked him "How did you know how to do that?" He responded "I didn't, I had to figure it out."
0 Kudos
Message 4 of 5
(3,138 Views)

Do you know if this only works in a published web service?  I tried this on the debug server and it only returns 0 as the port.



I saw my father do some work on a car once as a kid and I asked him "How did you know how to do that?" He responded "I didn't, I had to figure it out."
0 Kudos
Message 5 of 5
(3,137 Views)