# Gamemaker multiplayer using 39dll

I am making a gamemaker multiplayer game using 39dll's tcp sockets. As I want to host the server (and my javascript knowledge is a lot better), I use node.js for the server. I have already got gamemaker to connect to the server and send data, but now I have a problem with receiving data. After reading a lot, it seems that I need to do that like so: sock=tcpaccept(global.tcpConnection,1);. If sock is a negative number, the creation of the 'listening' interface failed. It returns me the number -10022. I can not find much information about it, so if anyone knows why this problem occurs and how to fix it would be very nice.

I am just making a normal gamemaker 8.1 game, no HTML5 game (I'd rather script that myself, not with gamemaker as I am really disliking it).

My server code:

var net = require('net');
var server = net.createServer(function(socket){
socket.on('data', function(d){
console.log(d.toString());
socket.write(d.toString());
});
socket.on('error', function(e){console.log(e)});
socket.on('close', function(){console.log('Socket closed');});
socket.write('hhhaaannbikbkm');
}).listen(process.env.VCAP_APP_PORT||8080);


GML code (in the game start event):

dllinit(0,true,true);
global.serverip = get_string("Server IP:","127.0.0.1");
global.serverport = get_integer('port', 8080);

global.tcpConnection = tcpconnect(global.serverip, global.serverport, 1);
setformat(2, '<!SEP!>');
if(!tcpconnected(global.tcpConnection)){
show_message("Connection failed");
game_end();
} else {
setnagle(global.tcpConnection,1);
clearbuffer();
sendmessage(global.tcpConnection, 1, 1);
while(true){
var sock, size, cnt;
sock=tcpaccept(global.tcpConnection,1);
show_message(sock);
//if (sock <=0) break;
setsync(sock,0);//block untill new package
show_message(size);
//setsync(sock,1);//unblock socket

I already fixed this like a week ago or so. I just don't need to call sock=tcpaccept(global.tcpConnection,1);, but just receive the messages with receivemessage(global.tcpConnection, 9999999);