Well now, what could that be for?
This commit is contained in:
parent
b904bb1e52
commit
4b9a6eb801
@ -17,6 +17,7 @@
|
||||
<script type="text/javascript" src="scripts/tool.js"></script>
|
||||
<script type="text/javascript" src="scripts/generator.js"></script>
|
||||
<script type="text/javascript" src="scripts/picker.js"></script>
|
||||
<script type="text/javascript" src="scripts/listener.js"></script>
|
||||
<!-- Styles -->
|
||||
<link rel="stylesheet" type="text/css" href="links/reset.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="links/fonts.css"/>
|
||||
|
@ -24,6 +24,7 @@ function Dotgrid (width, height) {
|
||||
this.interface = new Interface(this)
|
||||
this.picker = new Picker(this)
|
||||
this.cursor = new Cursor(this)
|
||||
this.listener = new Listener(this)
|
||||
|
||||
host.appendChild(this.renderer.el)
|
||||
|
||||
|
27
desktop/sources/scripts/listener.js
Normal file
27
desktop/sources/scripts/listener.js
Normal file
@ -0,0 +1,27 @@
|
||||
'use strict'
|
||||
|
||||
const dgram = require('dgram')
|
||||
|
||||
function Listener (dotgrid) {
|
||||
this.server = dgram.createSocket('udp4')
|
||||
|
||||
this.start = function () {
|
||||
|
||||
}
|
||||
|
||||
this.server.on('error', (err) => {
|
||||
console.log(`server error:\n${err.stack}`)
|
||||
server.close()
|
||||
})
|
||||
|
||||
this.server.on('message', (msg, rinfo) => {
|
||||
console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`)
|
||||
})
|
||||
|
||||
this.server.on('listening', () => {
|
||||
const address = this.server.address()
|
||||
console.log(`server listening ${address.address}:${address.port}`)
|
||||
})
|
||||
|
||||
this.server.bind(49160)
|
||||
}
|
Loading…
Reference in New Issue
Block a user