Created
October 27, 2015 11:24
-
-
Save kylestev/6c666a312358e9fd0aa0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Socket } from 'net'; | |
import * as struct from 'bufferpack'; | |
let sock = new Socket({ readable: true, writable: true }); | |
sock.connect({ | |
host: 'oldschool1.runescape.com', | |
port: 43594 | |
}, () => { | |
// first we bind a listener to all incoming data | |
sock.on('data', (buff) => { | |
let versionPacket = buff.readInt8(0); | |
let verisionIsCurrent = (versionPacket !== OP_OUTDATED); | |
// ^ is a boolean, do what ever you want with it now; | |
}); | |
// then we send our data | |
sock.write(struct.pack('>bi', [15, revision])); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment