Server to client: how to transmit ellipse coordinates

How would i send the x and y coordinates of an ellipse from one computer to another. Any help would be great thanks.

You’ll find the reference for the Network library here: https://processing.org/reference/libraries/net/index.html

There’s an example to do this that comes with the Processing software. Open the Examples and then navigate to Libraries > Network > SharedCanvasClient and SharedCanvasServer

1 Like

An option is to use OscP5 library. Install it in your PDE using the Contribution manager. Check example under Files>>Examples>>Contributed Libraries and also explore previous posts in the forum. They are a great resource.

Kf

1 Like

It isn’t working i start the server on computer 1 that have the same port and on computer 2 run client but on computer 2 i do not receive anything from the server. Am i doing something wrong?

Have you specified the IP address in the client sketch? By default it is 127.0.0.1 but that references to the same computer (i.e. the sketches must be running on the same machine).

You have to find out on which IP the server is running. In Processing you can do this with println(Server.ip());, which is correct most of the time but it’s not guaranteed. It prints the device’s IP of the first network connection. So if you have one connected internet adapter that’s fine. But if you have multiple (connected with both wifi and ethernet cable for example) it might not be. In that case you can (on Windows) open a command prompt (hit the windows key then type “cmd”, or use windows+r and type “cmd”) and use the command “ipconfig”. You should get a list of all connected network adapters. The IP address will probably look something like this: “192.168.XXX.XXX”, indicating a local network. But it could be something else as well depending on your router.

3 Likes

Thanks so much it worked. I spent two days trying to find out what you just explained. Thanks again.