[JAVA] 'Network' library related - server issue

[JAVA] ‘Network’ library related - server issue

hello.

Reference link: available() / Libraries / Processing.org

  Client thisClient = myServer.available();
  if (thisClient !=null) {
  // 1) T1 : Initial connection time
    String whatClientSaid = thisClient.readString();
    if (whatClientSaid != null) {

 // 2) operations, functions, calculations

    }
  // 3) T2 : Finish time

  }

Please refer to the picture.
‘TCP SERVER’ operates in ‘DRAW(LOOP)’.
However, when times overlap as shown in the picture, an error occurs. Is there any way to solve this problem?
(Summary: If signals overlap during work, an error occurs)

Client thisClient = myServer.available();

Q1. myServer.available() / Can’t this be made in thread form?

Hello @GWAK ,

These are available to you and run independently of the draw() loop:

I modified the SharedCanvasClient and SharedCanvasServer to use only events (draw was empty for each of them) and some handshaking to request new data only after it was received. It even worked with noLoop()!

image

Reference:

thread() / Reference / Processing.org

:)

1 Like

@glv

Yes, thank you for your reply.
It might be usable. thank you.

1 Like