Skip to content

Network library examples work in 3.4, but broken in Processing 3.5.4/4.0a3  #6166

@KouichiMatsuda

Description

@KouichiMatsuda

Description

I wrote the following simple_server.pde and simple_client.pde using "processing.net.*;" but their behaviors seem to be strange.
The simple_client.pde seems to receive "Hi" and "Yes".
Am I missing something?

// simple_server
import processing.net.*;
Server svr;

void setup() {
  svr = new Server(this, 5555); 
  size(450, 255);
}

void draw() {
  Client c = svr.available();
  if (c != null) { 
    String s = c.readString(); // 読み込む
    println(s);
    svr.write("Yes");
  }
}
// simple_client
import processing.net.*; 
Client c; 

void setup() { 
  c = new Client(this,"127.0.0.1", 5555);
  size(450, 255);
} 

void draw() {
  if (c.available() > 0){
    String s = c.readString(); 
    println(s);
  }
}

void mouseClicked() {
  c.write("Hi"); 
}

Expected Behavior

"Hi" should be displayed in the console of the simple_server and "Yes" should be in the console of the simple_client.
Processing 3.4 has this behavior but Processing 3.5 (4.0a3) doesn't.

Current Behavior

Both "Hi" and "Yes" are displayed in the console of the simple_client.

Steps to Reproduce

  1. Execute the simple_server.
  2. Execute the simple_client.
  3. Click the simple_clinet window.

Your Environment

  • Processing version: Processing 3.5.4 (4.0a3)
  • Operating System and OS version: Windows 10 Pro, version 2004, build, 19041.804
  • Other information: Processing 3.4 seems to behave as expected.

Possible Causes / Solutions

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedWe have very little time and would like some help

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions