LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop with TCP listen

Hello
 
I'm trying to do the LabView VI with the functionnality I will describe with a pseudo-coding language:
function sendCommands( String address, String commands ) {
    Socket sock = connect( address, 23 )    // 23 is Telnet
    String[] commandsArray = commands.split( "\n" )
    String responses = ""
 
    for( i = 0 ; i<commandsArray.length ; i++ ) {
        send( sock, commandsArray[i] )
        String currentAnswer = receive( sock )
        responses = responses + currentAnswer
    }
 
    return responses
}
I've been able of creating the socket, sending one command and receiving the response, on the other hand I don't understand how to do the following:
  1. How do I split a string?
  2. How do I send each piece of the string one by one?
  3. How to I concatenate two strings, based on the result of the previous concatenation?

Attached the current version of my work. Comments are in french, I can translate if needed Smiley Wink

Thank you

Message Edited by alitokmen on 05-03-2007 08:57 AM

S. Ali Tokmen
http://ali.tokmen.com
0 Kudos
Message 1 of 3
(2,813 Views)
Hello,

I'll try to answer the best I can :

1 : To split a string : There is a VI named "search/ split string" ... (about 10 sec)
2 : either you use a flat sequence, and you send a string in each step, or you create an array with your string, and you send each elements in a for loop...
3 : To concatenante a string, just use the VI named "concatenante strings...

Hope this helped

Regards

Richard Keromen

0 Kudos
Message 2 of 3
(2,787 Views)

Hello

Thank you for your message: it has been very helpful for me. I've therefore done a new version of the VI.

I'm also attaching it, just in case someone else needs it.

Comments are still in french 🙂

S. Ali Tokmen
http://ali.tokmen.com
0 Kudos
Message 3 of 3
(2,772 Views)