
GBot

Hello All,
I have successfully set up a TCP server in order to communicate with a Processing client running on the same computer as EZ-Builder. I am able to send data (variables) from Processing to ARC by simply using a myClient.send(blahblah) command. However, I cannot figure out how to send information to the Processing client from EZ-Builder. I have tried sendUDP("127.0.0.1", 9000, "hello world") etc, with no luck.
By the way, when I use myClient.readString() and print it to the terminal in Processing, I see:
EZ-Builder v2017.06.23.00 on TTY0
>
So I know that ARC is able to send information to this program, I just don't know how.
Am I missing something?
Thanks!
I don't believe ARC currently has a SendTCP command, I suspect because there is typically more negotiation required for TCP client/server communications than just a send or receive of one message at a time. There is a GETUrl command if you set up a web service for receiving commands, or it would be fairly straightforward to write a plugin specific to your particular TCP Server.
Alan
Alan
TCP is stateless. Requires an actual negotiated connection. Udp does not.
What are you trying to do? Just use the tcp server. You can query variables or anything you want. Have you not looked at the tutorial page for the connection control? The question mark tells all.
In the tcp server, you csn "print $variable" even...
DJ, yes I have read the connection control tutorial. I spent a good deal of time looking into this before asking my question. its not fun to be slammed for asking a question tho.
As I said, i have set up the server. I have been able to pass variables from my client program to ARC. What i cannot do is send data to the client.
Here is a simple script in processing that demonstrates what I want to do:
Code:
When I hit run on this sketch, I can see in ARC that a TCP connection is established. In Processing, I get a readout of "ARC v2017.06.23.00 on TTY0 >" in the console. However, what i cannot do is send data from ARC to the client and read it out in the console. I honestly don't know why you would tell me to learn TCP...I am quite familiar with it using telnet, putty, etc. My question is how do I write info to a socket using your ARC program. I'm sorry that it isn't apparent to me, thus the question.
Your client can send commands and the data is returned, like telnet.
As my example states, if you send "print $variable" to the server from client, the $variable data will be returned.
Tcp is not like udp. You cannot simply send data to an IP address without negotiated connection. The sendudp() command can't be applied to tcp. Udp doesn't require a connection.
Tcp requires a stateful connection. I suggest reading a tad about tcp to understand how you can do what you're attempting to do.
If you tell me what data you'd like to return to your client, I can provide an example command to send
IE, sending ARC "print $variable" it will respond with the contents of $variable, because your TCP client has established hte socket and is holding it open. But EZ-Script would not know about that socket, so it can't send to it.
To send from an EZ-Script, you need to listen for UDP, not TCP packets (since UDP doesn't require a pre-negotiated socket connection), and then use the SendUDP command. Or, since you seem ot have some programming ability, you could write a TCP client plugin that can establish and maintain the tcp socket connection to your TCP server and send it script commands. Interacting with a plugin would typically be done with the ControlCommand script statement).
Alan
Follow his advice of providing more details on your goal. I tend to overthink solutions and DJ may have a simpler way of doing it.
Alan
My issue was that when the client asked for data via print(variable) etc, I needed to strip the trailing carriage return before it became usable.
If you'd like, there is a plugin system as well. You can create a quick plugin that can communicate with your Processing project. Let me know how I can help