LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tcp connection to Processing not working

Hello,


I had a processing code designed for me to generate 8 different types of an audio signal - labeled as 8 conditions for an experiment i am running. I can use processing and Supercollider to play the audio signals no problem but when I try to set up an TCP connection between Processing and labview (2009 version) to run my experiment it does not execute the commands that have already been embedded into the processing code. I am using the correct port and IP address, as specified in the processing code but for some reason the commands that I set in labview, to generate the audio condition, do not work.


I can provide the audio code if necessary. When I 'run' the TCP connection in labview no errors are reported so it is making a connection but for some reason the command (e.g. 'C1' for condition 1) does not execute and I hear no audio.


any help would be greatly appreciated,

 

0 Kudos
Message 1 of 20
(3,710 Views)

Do your commands require a termination character of some sort such as a carriage return or line feed? Are the commands case sensative? From what you describe it sounds like your server (processing code?) is not recognizing the commands you are sending and this most likely would be something with the format of the commands themselves.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 20
(3,681 Views)

The commands are simply 'C1' or 'C2' etc and i've tried with and without caps lock but with no luck. I will try changing the commands in the processing code and see if it will make any difference.

 

Processing is a software used to generate Audio signals, these signals are generated by using a code that was created for me. 

 

thanks for your help

0 Kudos
Message 3 of 20
(3,677 Views)

Have you tried sending the command followed with a newline, or carriage retrun and newline? Is your application waiting from some other termination character? Is it expecting a specific length for the command? Can you use something like telnet from the command line to talk to your processing application?



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 20
(3,670 Views)

I don't think telnet would work as I am communicating from one software to another on the same computer. Also I do not know how to adapt the processing code if telnet would work.

 

In the code it states the following:

 

//OUR PROTOCOL VALUES
static String MESSAGE_STOP = "STOP";
static String MESSAGE_C1 = "C1";
static String MESSAGE_C2 = "C2";
static String MESSAGE_C3 = "C3";
static String MESSAGE_C4 = "C4";

 

 

I will try adapt the commands and see if that will make any difference but I have already changed the 'C1' etc to include just single numbers such as '1' and there is still no luck with making the connection. I am only using TCP open connection, TCP read and TCP close connection to create the connection this may be too simple and may require more programming?

0 Kudos
Message 5 of 20
(3,665 Views)

You can telnet to the local machine. Just use localhost or 127.0.0.1 for the hostname. If you can't connect using telnet then you can't connect using LabVIEW either.

=====================
LabVIEW 2012


0 Kudos
Message 6 of 20
(3,660 Views)

thanks for the help I will try telnet and see if it works.

 

 

0 Kudos
Message 7 of 20
(3,657 Views)

So, you are writing the LabVIEW code to read the commands? I thought you were writing the code to send the commands to the other application. Since you are writing teh code to read the data you need to specify the number of characters to read or a termination character (carriage return/line feed). Which you use will depend on what is being sent.

 

If you could post your code it would help. Post it as 2009 though since I don't have 2010 installed.

 

Note: Standard command line telnet will work too. Simply use the same IP address and port you are using in your application.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 20
(3,656 Views)

Apologies i may not have been clear before. The processing software is listening for a connection from labview. I am using the TCP connection to send a command (i.e. 'C1') to processing so that it will be executed. The reason I am using the TCP connection is because for my experiment I require subjects to follow this audio signal which is connected to the DAQ. I am basically assessing how well subjects can follow the signals. Labview allows me to run the experiment and all its elements at once. 

 

I have sample labview work that I am basing everything on which I am told worked fine before but for some reason when i replicate their labview work it doesn't seem to work for me.

 

Attached is the 'labview connection patch' code that I run in 'Processing'. This code basically listens at a particular port/Ip address for a connection/command

 

0 Kudos
Message 9 of 20
(3,642 Views)

So you have access to the server code? Does it print the incomingData in the labViewParse function?

=====================
LabVIEW 2012


0 Kudos
Message 10 of 20
(3,639 Views)