Skip to content

Commit b5dd3b4

Browse files
committed
Net-server: call clientEvent() of the sketch when received data from a client
1 parent bbfcbb3 commit b5dd3b4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

java/libraries/net/src/processing/net/Client.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,15 @@ public Client(PApplet parent, Socket socket) throws IOException {
129129
thread.start();
130130

131131
// reflection to check whether host sketch has a call for
132-
// public void disconnectEvent(processing.net.Client)
132+
// public void clientEvent(processing.net.Client)
133+
// which would be called each time an event comes in
134+
try {
135+
clientEventMethod =
136+
parent.getClass().getMethod("clientEvent", Client.class);
137+
} catch (Exception e) {
138+
// no such method, or an error.. which is fine, just ignore
139+
}
140+
// do the same for disconnectEvent(Client c);
133141
try {
134142
disconnectEventMethod =
135143
parent.getClass().getMethod("disconnectEvent", Client.class);

0 commit comments

Comments
 (0)