Most-Pixels-Ever-Processing icon indicating copy to clipboard operation
Most-Pixels-Ever-Processing copied to clipboard

Not getting frameEvents in Asynchronous mode

Open andrele opened this issue 11 years ago • 1 comments

On Processing 2.0.3:

  • Used the mpeTest sketch
  • Moved dataEvents to its own method
  • Added <asynchronous>true</asynchronous> and <asynchreceive>true</asynchreceive> to mpe.xml
  • Started sketch and server and Processing reports:
MPE CLIENT VERSION 2.0.2
Client: Starting!
Client: Connected to server!
Client: Sending: A|0|true
  • Server reports:
$ java -jar mpeServer-2.0.2.jar 
MPE SERVER VERSION: 2.0.2
MPEServer: framerate = 30, screens = 1, waitForAll = false, verbose = false
Starting server: Andres-rMacBook-Pro.local/10.37.129.2  9002
/127.0.0.1:57056 connected.
Connecting asynch client 0 receiver: false

The sketch frame stays blank, and nothing in frameEvent is being called. Works fine in synchronous mode.

image

andrele avatar Dec 05 '13 00:12 andrele

I have most than probably the same issue with processing 3.3.6 implementing a async communication between a client (command center) and a server (rendering) application

server is started :

MPE server started MPE SERVER VERSION: 2.0.3 MPEServer: framerate = 30, screens = 2, waitForAll = true, verbose = true Starting server: sbxjld10/192.168.0.52 9002

The first application connects to the server :

/127.0.0.1:54411 connected. Raw receive: A|999|true Connecting asynch client 999 receiver: false

Note that, while the raw message says client 999 has ASYNC set to true, the server says in the message that async is false. the same happens to the other application that is connecting

/127.0.0.1:54413 connected. Raw receive: A|1555|true Connecting asynch client 1555 receiver: false Adding message to next frameEvent: 1555,R=73

BTW, the two XML files have both two async flags set to true

<settings>
	<id>1555</id>
	<server>
		<ip>localhost</ip>
		<port>9002</port> 
	</server>
	<asynchronous>true</asynchronous>
	<asynchreceive>true</asynchreceive>
	<verbose>true</verbose>
</settings>

the problem is possibly due to coding at line 76 in connection.java :

While there are 3 tokens in this message (see raw data: A|1555|true), the code examines the boolean value found in message only if there are more than 3 element (tokens.length > 3) In the code below, it examines tokens[3], while it should, IMO, be (tokens.length > 2) and array ref should be tokens[2] instead.

String[] tokens = msg.split("\\|");
  			if (tokens.length > 3) {
  				try {
  					asynchReceive = Boolean.parseBoolean(tokens[3]);
  				} catch (Exception e) {
  					System.out.println("Malformed boolean for synch receive");
  				}
  			}

System.out.println("Connecting asynch client " + clientID + " receiver: " + asynchReceive);

Do you think this is something you could correct ? Thank you for helping.

sbxjld2 avatar Jan 01 '18 11:01 sbxjld2