LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can VISA create a TCP listener?

I know the TCP primitives allow me to create a TCP listener, but can VISA do the same thing?  I have an application which will communicate over serial or TCP.  I need to be able to programmatically switch between the two, and so would like to use the same VISA resource wire in my application.  This works fine when I'm the one creating the connection, but with the VISA resource I have no way of receiving a connection (i.e. through a listener).  Is there a better way to do this or am I stuck using both a VISA resource wire and a TCP reference wire?
 
Thanks for your thoughts,
Robert Mortensen
CLA, CLED, LabVIEW Champion, Principal Systems Engineer, Testeract
Message 1 of 11
(5,354 Views)

Hey FlamingYawn,

Usually you can pass references as strings, and labVIEW will automatically coerce it to the correct datatype. Can you make a case structure for the COM string, and one for the TCP resource string?

Regards,

Nick D.

If that doesn't work, can you include a simple screenshot of how you're wiring the TCP resource into the VISA vi?

 

0 Kudos
Message 2 of 11
(5,332 Views)

Hi Nick,

The problem is that VISA returns a VISA resource and the TCP Listener returns a TCP reference.  These are two separate APIs.  In order to use the same reference throughout my application, I need to use the same API, so I have the same reference type.  But I don't see any way for VISA to create a listener.  Can you find out if this is possible?

Thanks,

Robert Mortensen
CLA, CLED, LabVIEW Champion, Principal Systems Engineer, Testeract
Message 3 of 11
(5,316 Views)
Hey,
 
I think I found something that relates in this similar forum.
 
Regards,
 
Nick D.
0 Kudos
Message 4 of 11
(5,290 Views)
Although similar, the linked discussion addresses a fundamentally different principle.  In the discussion, VISA is still making the TCP connection and then waiting for data to come back.  I would like VISA to be the listener, which means that VISA waits for something else to establish the TCP connection.  Can you find out if this is possible, and if not, why not?

Thanks,
Robert Mortensen
CLA, CLED, LabVIEW Champion, Principal Systems Engineer, Testeract
Message 5 of 11
(5,267 Views)
What happens when you use a tcp/ip raw resource name, do a VISA Open, and then just do a VISA Read?
0 Kudos
Message 6 of 11
(5,261 Views)
The VISA Open tries to connect to a listener at that ip address, doesn't find one, and throws an insufficient location information error.
Robert Mortensen
CLA, CLED, LabVIEW Champion, Principal Systems Engineer, Testeract
0 Kudos
Message 7 of 11
(5,254 Views)

That I don't quite understand. If I have an Ethernet instrument, it will connect to that. 

Even if this did work, you could not use the same VISA reference for the serial and the Ethernet connection. You would still have to open a reference to a serial connection, do the communication over the pc's serial port, close it, then open the tcp/ip connection, do the communication over the px' ethernnet port, and then close that. At best, you would be able to use only one api but i don't see how you can ever use the same reference for both serial and ethernet.

0 Kudos
Message 8 of 11
(5,251 Views)
I'm not trying to connect to an instrument.  I want another computer to connect to me.

For my application, I don't want to use the VISA reference for both serial and Ethernet at the same time.  I will be using one or the other.  The setup code will obviously have to be different depending on which I'm using, but since all the messages are the same strings for either interface the rest of the code can be the same.  This all works great when I'm the one connecting to the other computer (which I have to do as well) but won't work when I'm the listener, because VISA doesn't seem to be able to create a listener.
Robert Mortensen
Software Engineer
National Instruments
Message 9 of 11
(5,247 Views)
Oops.  I was still logged in under my old NI account.  I guess they don't shut those down when you leave NI!
Robert Mortensen
CLA, CLED, LabVIEW Champion, Principal Systems Engineer, Testeract
0 Kudos
Message 10 of 11
(5,244 Views)