mirror of
https://github.com/jwetzell/psn-js.git
synced 2026-08-13 03:13:52 +00:00
initial commit
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
const dgram = require('dgram');
|
||||
const { Decoder } = require('.');
|
||||
|
||||
const client = dgram.createSocket('udp4');
|
||||
|
||||
const psnDecoder = new Decoder();
|
||||
|
||||
client.on('listening', () => {
|
||||
const address = client.address();
|
||||
client.setBroadcast(true);
|
||||
client.setMulticastTTL(128);
|
||||
client.addMembership('236.10.10.10');
|
||||
});
|
||||
|
||||
client.on('message', (message, remote) => {
|
||||
psnDecoder.decode(message);
|
||||
});
|
||||
|
||||
client.bind(56565, '0.0.0.0');
|
||||
Reference in New Issue
Block a user