LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Socket functions and /etc/hosts and /etc/services

I have verified that I con open a socket with either the host name or the IP address.

 

But can I use either the port number or the service name (from /etc/services)?

It allows me to use a string constant instead of a numeric, but it doesn't seem to work.

0 Kudos
Message 1 of 6
(2,879 Views)

I have no experience with Linux or with this particular feature, but the help says that LV knows which port coresponds to the service by using the NI service locator. I would start by checking if it's supported on Linux (probably yes, or I'm assuming the help would say it's not supported) and then checking if it's running and if other people have run into this on Linux.


___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(2,864 Views)

Hi Randy,

 

This is Doug from Applications Engineering at NI. I'm looking into your issue and would appreciate it if you could please elaborate about what specifically you are trying to accomplish. With datasockets, the outbound port is statically set to 3015 (http://digital.ni.com/public.nsf/allkb/CEF5A3568A5DA71D8625732800520EA1  &  http://digital.ni.com/public.nsf/allkb/FCF8A1464BD2F6D686256B59007C9A6F) and cannot be reassigned. You can however specify the inbound port to which you are trying to send your data with the hostname/IP followed by a ":" and the port number. If you need further assistance, please reply with some more details about your problem and I'll do my best to try to solve it.


Thanks

Doug W

Applications Engineer
National Instruments
0 Kudos
Message 3 of 6
(2,848 Views)

I am using the socket functions for plain socket communictions to a "c" server.  Not for NI defined Data-Sockets, etc.

I supply the address as either a host name or an IP address and that works.

I would like the port numer to be either a service (as defined in the /etc/services file), or a numeric port number.  The service name does not work.

0 Kudos
Message 4 of 6
(2,840 Views)

Hi Randy,

 

Could you identify which socket functions specifically you are using? Also, when you use a string constant instead of a numeric for the service name and it doesn't work, do you get an error or does it just not work? It is very likely that what you are trying to accomplish is not directly supported from the primitive function in labview and you may have to use external library functions or system calls to obtain the port number from the service name. But, if you can give a step-by-step scenario of what functions you are using that can help us further troubleshoot the problem. Code snippets or screenshots will also be helpful towards resolving this issue.

 

Doug W.

Applications Engineer
National Instruments
0 Kudos
Message 5 of 6
(2,832 Views)

The string form for the port number is specifically meant to use the NI Service Locator service and nothing else. It does not link into /etc/services or anything like that at all but is a proprietary service locator solution from NI. There exist LabVIEW VIs that one can use to both query this service as well as register new services. It can be found at vi.lib/Utility/ServLocInterface.llb. The actual service used to be programmed in LabVIEW around LabVIEW 7.0 but quickly was moved to a real system service at least on Windows. Not sure if other platforms still use the VI based service implementation or have a native service deamon too, for this.

 

Theoretically it would be possible to create some translation program in LabVIEW that reads /etc/services and then registers them through the service locator API but I'm not sure I see a real benefit in this.

Rolf Kalbermatter
My Blog
0 Kudos
Message 6 of 6
(2,827 Views)