Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var net = require('net');
- var HOST = 'coc.waterphuket.com';
- var PORT = 6969;
- var client = new net.Socket();
- var i = 0;
- var answer = 3;
- end = () =>{
- client.on('close', function() {
- console.log('Connection closed');
- });
- }
- send = () => {
- client.on('data', function(data) {
- console.log("DATA : " + data)
- console.log("SEND : " + answer)
- if(data=='OK'){
- console.log("DATA : OK " )
- client.write(''+answer);
- }else if(data == 'WRONG'){
- console.log("DATA : WRONG " )
- client.write(''+answer);
- }else if(data == 'BINGO'){
- console.log("BINGO : " + answer)
- client.destroy();
- end()
- }else if(data == 'END'){
- client.destroy();
- }
- if(i==4){
- client.destroy();
- //connect()
- setInterval(connect,5000)
- i=0;
- }
- if(answer == 21){
- answer = 0
- }
- answer++
- i++
- });
- client.on('error' , (err) => "")
- }
- connect = () =>{
- client.connect(PORT, HOST, function() {
- console.log('CONNECTED TO: ' + HOST + ':' + PORT);
- client.write('5935512030');
- });
- send()
- }
- connect()
Advertisement
Add Comment
Please, Sign In to add comment