RPC Over UDP Command format is same as serial RPC (not HTTP RPC). Please find attached Test Program(processing & ActionScript3) at end of this file.
Dependencies: EthernetNetIf mbed
Revision 1:918ffa99c345, committed 2010-11-16
- Comitter:
- xshige
- Date:
- Tue Nov 16 14:11:31 2010 +0000
- Parent:
- 0:797742779818
- Commit message:
- 2010/11/16 Fixed the attached test program(processing) to run it in both Windows and Linux.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 797742779818 -r 918ffa99c345 main.cpp --- a/main.cpp Mon Nov 15 17:16:23 2010 +0000 +++ b/main.cpp Tue Nov 16 14:11:31 2010 +0000 @@ -15,6 +15,10 @@ * */ +// 2010/11/16 +// Fixed test program(processing) +// to run it in both windows and linux. + // 2010/11/15 // written by: xshige @@ -59,14 +63,16 @@ #ifdef SENDBACK_UNICAST Host recHost(IpAddr(239, 255, 0, 1), INPUT_PORT, NULL); // Receive Port (RPC input) // multicast IP -// "224.0.0.1" does not work(can Not receive) -// "224.0.0.2" works correcly. +// "224.0.0.1" works correctly. +// "224.0.0.2" does not work(can Not receive) // "239.255.0.0"-"239.255.255.255" (Site-Local Scope) maybe work #else // please change IP address to fit your enviroment // unicast IUDP Host sendHost(IpAddr(192, 168, 0, 7), OUTPUT_PORT, NULL); // Send Port (RPC output) Host recHost(IpAddr(192, 168, 0, 7), INPUT_PORT, NULL); // Receive Port (RPC input) +//Host sendHost(IpAddr(239, 255, 0, 1), OUTPUT_PORT, NULL); // Send Port (RPC output) +//Host recHost(IpAddr(239, 255, 0, 1), INPUT_PORT, NULL); // Receive Port (RPC input) #endif // receive commands, and send back the responses @@ -177,6 +183,10 @@ // Important Note: // this program can NOT work in windows enviroment (only Linux enviroment) +// +// 2010/11/16: +// Above bug fixed. Now it can work in both windows and linux. +// Note: Please set your host IP. /** * RCP over UDP (by mbed) @@ -191,6 +201,7 @@ import hypermedia.net.*; String remoteIP = "239.255.0.1"; // multicast IP +String localIP = "192.168.0.7"; // please set your host IP (2010/11/16) int INPUT_PORT = 8000; int OUTPUT_PORT = 8001; @@ -202,7 +213,7 @@ void setup() { // create a new datagram connection on port OUTPUT_PORT // and wait for incomming message - udp = new UDP( this, OUTPUT_PORT ); + udp = new UDP( this, OUTPUT_PORT, localIP ); // (2010/11/16) // udp.log( true ); // <-- printout the connection activity udp.listen( true ); } @@ -351,13 +362,13 @@ targetIP = createTextField( 10, 10, "Target IP:", "239.255.0.1" ); targetPort = createTextField( 10, 35, "Target port:", "8000" ); - + message = createTextField( 10, 60, "Message:", "/AnalogIn/new p20 ain" ); // localIP = createTextField( 10, 85, "Local IP", "0.0.0.0"); // localPort = createTextField( 10, 110, "Local port:", "0" ); - localIP = createTextField( 10, 85, "Local IP", "192.168.0.7"); // set your host IP - localPort = createTextField( 10, 110, "Local port:", "8001" ); + localIP = createTextField( 10, 85, "Local IP", "192.168.0.7"); // set your host IP + localPort = createTextField( 10, 110, "Local port:", "8001" ); createTextButton( 250, 135, "Bind", bind ); createTextButton( 300, 135, "Send", send );