Initial commit
This commit is contained in:
19
fs/clockClient.js
Normal file
19
fs/clockClient.js
Normal file
@@ -0,0 +1,19 @@
|
||||
load('api_net.js');
|
||||
load('api_rpc.js');
|
||||
|
||||
let port=2000;
|
||||
let lastMessage = "";
|
||||
|
||||
Net.bind(port, function(conn, ev, ev_data) {
|
||||
if (ev !== Net.EV_ACCEPT) return;
|
||||
Net.send(conn, JSON.stringify({a: 1, b: 'hey!'}));
|
||||
Net.close(conn);
|
||||
}, true);
|
||||
|
||||
print('TCP server is listening on port ', port);
|
||||
|
||||
RPC.addHandler('UpdateClock', function(args) {
|
||||
lastMessage = JSON.stringify(args);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user