Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.net.*;
- Client client;
- String keyboardInput = "";
- void setup()
- {
- size(300, 300);
- client = new Client(this, "10.11.4.92", 5204);
- }
- void draw()
- {
- background(255);
- if (client != null)
- {
- if (client.readString() != null)
- {
- String incomingMessage = client.readString();
- incomingMessage = incomingMessage.trim();
- println("server : " + incomingMessage);
- }
- }
- }
- void keyPressed()
- {
- if (key != '\n')
- keyboardInput += key;
- else
- {
- println("client : " + keyboardInput);
- client.write(keyboardInput);
- keyboardInput = "";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement