-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Asynch Client now supported in client and server
- Loading branch information
Showing
3 changed files
with
104 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Most-Pixels-Ever-Processing/src/mpe/examples/ASyncClientExample.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package mpe.examples; | ||
|
||
import mpe.client.*; | ||
import processing.core.*; | ||
|
||
public class ASyncClientExample extends PApplet { | ||
//-------------------------------------- | ||
|
||
TCPClient client; | ||
|
||
//-------------------------------------- | ||
static public void main(String args[]) { | ||
PApplet.main(new String[] { "mpe.examples.ASyncClientExample" }); | ||
} | ||
|
||
//-------------------------------------- | ||
public void setup() { | ||
size(320,240); | ||
// make a new Client using an INI file | ||
client = new TCPClient("asynch.xml", this); | ||
|
||
// IMPORTANT, YOU MUST START THE CLIENT! | ||
client.start(); | ||
} | ||
|
||
public void draw() { | ||
|
||
} | ||
|
||
|
||
|
||
//-------------------------------------- | ||
// Adds a Ball to the stage at the position of the mouse click. | ||
public void mousePressed() { | ||
// never include a ":" when broadcasting your message | ||
int x = mouseX*2; | ||
int y = mouseY*2; | ||
client.broadcast(x + "," + y); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters