elmwood Posted February 15, 2010 Posted February 15, 2010 I have different variables that I would like to include as string data to be sent to the connected UDP socket using the UPDSend function. The problem is that I would like to send commands such as UDPSend = ($socket, "Init") and if I try to use the string variable $init_string = " ""Init"" " the function doesn't accept the input. How can I achieve having a variable equal to Init and including that into the UDPSend function as "Init" without having to actually type "Init" into the UDPSend function? Help appreciated.
elmwood Posted February 15, 2010 Author Posted February 15, 2010 OK, I semi-answered my own above question by searching through the forum. Here is an example of what I did. $TR1 = 1 $TR2 = 2 $TRa = "SET_TRANSMISSION_RATE_PERCENT" $TR_final = '"' & $TRa & ' ' & $TR1 & ' ' & $TR2 & '"' MsgBox(0,"", $TR_final) Basically I used the '"' and ' ' to simulate quotations and a space respectively. The problem is even though the $TR_final variable is "SET_TRANSMISSION_RATE_PERCENT 1 2" it still doesn't accept the UDPSend($socket, $TR_final) command to the device properly. However, If I send the command UDPSend($socket, "SET_TRANSMISSION_RATE_PERCENT 1 2") the command is sent properly. It should be the same thing. What's wrong here?
elmwood Posted February 15, 2010 Author Posted February 15, 2010 OK, now I have fully answered my own question and I wonder why I even posted to begin with. Maybe someone else can use this information in the future. Really the answers were quite simple, they just took some playing around for it to dawn on me. Basically, I didn't need to include quotations around the string that I would use for "data" in the UDPSend function. So just: ... $TR_final = $TRa & ' ' & $TR1 & ' ' & $TR2 UDPSend($socket, "$TR_final") did the trick.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now