FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 1345 : clientEvent gets executed even when there is not data from server
Last modified: 2010-02-17 19:26
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
ASSIGNED
Resolution:
-
Pr
i
ority:
P4
Severity:
normal
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
Anonyman
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2009-10-08 15:45
--------------------- General Local System Info
Processing 1.0.7
Windows XP Pro SP3
Toshiba T2300
-------------------- Bug description
When using the clientEvent procedure from the network library, the
procedure gets triggered all the time even when no data is coming from the
server.
----------------------- Test code and output
The following program starts a client to the Roborealm telnet server and
writes a command. The clientEvent procedure is supposed to get data from
server when available. As the output shows, clientEvent is triggered
regularly without any data available.
--------------------------------- CODE
import processing.net.*;
Client myClient;
int dataIn;
byte[] byteBuffer = new byte[128];
// The program tries to talk to RoboRealm telnet interface on port 6060.
void setup() {
println("Starting");
myClient = new Client(this, "127.0.0.1", 6060);
println("Querying");
myClient.write("<request><get_all_variables></get_all_variables></request>");
println("Waiting");
}
// Empty draw loop
void draw() {
}
// Client Event gets data from server and prints it or says "no data available"
void clientEvent(Client myClient) {
print("Server Says: ");
if (myClient.available() > 0) {
int byteCount = myClient.readBytes(byteBuffer);
if (byteCount > 0 ) {
// Convert the byte array to a String and print it
String myString = new String(byteBuffer);
println(myString);
}
}
else {
println("No Data");
}
}
------------------------ OUTPUT
Starting
Server Says: No Data
Querying
Waiting
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says:
<response><POWER_LIFE_TIME>-1</POWER_LIFE_TIME><FPS></FPS><IMAGE_TIME>0.000000</IMAGE_TIME><IMAGE_WIDTH>640</IMAGE_WIDTH><SERVO_
Server Says:
VALUE>0</SERVO_VALUE><IMAGE_HEIGHT>480</IMAGE_HEIGHT><POWER_LIFE_PERCENT>100</POWER_LIFE_PERCENT><PROCESS_TIME>31</PROCESS_TIME>
Server Says:
<MOVEMENT_PERCENT>0</MOVEMENT_PERCENT><IMAGE_COUNT>164</IMAGE_COUNT><POWER_CHARGE>HIGH</POWER_CHARGE><IMAGE_PROCESSED>164</IMAGE
Server Says:
_PROCESSED><MOVEMENT_PIXELS>0</MOVEMENT_PIXELS><POWER_DEVICE>AC</POWER_DEVICE></response>OWER_CHARGE><IMAGE_PROCESSED>164</IMAGE
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Additional Comment
#1 From Anonyman 2009-10-15 18:29
In addition, another est has been done on a SSH server.
Address has been modified and port is 22.
The result is the same :
Starting
Server Says: SSH-2.0-OpenSSH_5.1
.... encrypted garbage (about 30 bytes) ...
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Server Says: No Data
Querying
Waiting
Server Says: No Data
Server Says: No Data
ClientEvent is still triggered regularly.
Additional Comment
#2 From fry 2010-02-17 19:26
k, this is now on the todo list.
This bug is now being tracked
here
.