19.03.2013 - Version 0.3.0 ported to Mac OS X
This commit is contained in:
25
main.cpp
25
main.cpp
@@ -211,6 +211,31 @@ void ke(char key, void*) {
|
||||
ser.setPin(p, !pins[p - 1]);
|
||||
}
|
||||
int main(int argc, char * argv[]) {
|
||||
PIKbdListener kbd;
|
||||
kbd.enableExitCapture();
|
||||
PICLI cli(argc, argv);
|
||||
cli.addArgument("sender");
|
||||
PIEthernet eth;
|
||||
int i = 0;
|
||||
bool _ok;
|
||||
if (cli.hasArgument("sender")) {
|
||||
while (!PIKbdListener::exiting) {
|
||||
_ok = eth.send("234.0.2.1", 10101, &i, sizeof(i));
|
||||
cout << "send " << i << " - " << (_ok ? "ok" : "fail") << endl;
|
||||
i++;
|
||||
msleep(100);
|
||||
}
|
||||
} else {
|
||||
eth.setParameter(PIEthernet::Broadcast);
|
||||
eth.open(":10101");
|
||||
eth.joinMulticastGroup("234.0.2.1");
|
||||
while (!PIKbdListener::exiting) {
|
||||
eth.read(&i, sizeof(i));
|
||||
cout << "receive " << i << endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
/*tm_.start(10.);
|
||||
PIConsole con(false, ke);
|
||||
con.enableExitCapture();
|
||||
|
||||
Reference in New Issue
Block a user