1 var dgram = require("dgram");
3 var server = dgram.createSocket("udp4");
5 server.on("message", function (msg, rinfo) {
6 console.log("msg: ", msg);
7 console.log("server got: " + msg + " from " +
8 rinfo.address + ":" + rinfo.port);
12 server.on("listening", function () {
13 var address = server.address();
14 console.log("server listening " +
15 address.address + ":" + address.port);
18 function parseMsg(msg) {
19 var lkb = msg.readUInt16BE(0);
22 for(i=2; i<(msg.length-1); i++) {
25 console.log("setname end to ", fnamend);
31 console.log("read request");
34 console.log("write request");
38 var fname = msg.toString("utf8", 2, fnamend);
39 var ftype = msg.toString("utf8", fnamend+1, msg.length-1);
41 console.log("fun is, '%s', '%s'", fname, ftype);
45 console.log("was netascii");
48 console.log("was octet");
51 console.log("errr: '", ftype, "'");