var dgram = require('dgram'),
    LogPacket = require('./logpacket.js');

var server = dgram.createSocket('udp4');

var secret = "";

function getAddress(address) {
	return address.address + ':' + address.port;
}

server.on('listening', function() {
	console.log('Server listening on ' + getAddress(server.address()));
});

server.on('message', function(message, remote) {
	var packet = LogPacket.parse(new Buffer(message), (secret.length > 0) ? secret : undefined);
	console.log(getAddress(remote) + " - " + packet.toString());
});

server.on('close', function() {
	console.log('Closed server');
});

server.bind(1337);

@@ -126,10 +126,10 @@
 t = 
-%22%22
+''
 ;%0A%0Af
@@ -366,16 +366,57 @@
 mote) %7B%0A
+%0A%09var value = 'Invalid packet';%0A%0A%09try %7B%0A%09
 %09var pac
@@ -501,16 +501,112 @@
 fined);%0A
+%09%09value = packet.toString();%0A%09%7D catch (e) %7B%0A%09%09value = 'Invalid packet %5B' + e.message + '%5D';%0A%09%7D%0A%0A
 %09console
@@ -635,33 +635,21 @@
 ) + 
-%22 - %22 + packet.toString()
+' - ' + value
 );%0A%7D

Replace quotes and ensure errors are handled