Socket io C++ Server does not respond to emit test

Socket io C++ Server does not respond to emit test


cocos2dx 3.17

I am having problems using socket io. I do not receive any kind of response from my android studio android emulator based client to my webstorm server test.

I try to emit a simple string to the server and have the console log it as seen below in the two examples:

Client Code:

Global::_sioClient = SocketIO::connect("", * this);

std::string examplestring = "tom";

Global::_sioClient->emit("emittest", examplestring);

Server Code:

var app = require('express')();
var http = require('http').Server(app);
var io = require('')(http);

port = 9000;
console.log('Listening on port: ' + port);

io.on("connection", (socket) => {
    console.log("New connexion..."); 

    socket.on("emittest", (examplestring) => {


When i run the sever in webstorm the listening on port 9000 message is displayed fine. but when i use my client to emit to the server nothing is ever received.


ok, tell us about your server setup.

Is there a firewall?

does it allow port 9000?

is something running on port 9000?

what does netstat say on your server?


There is i also have turned it off just for the duration of this test.

I opened the port 9000 in router settings and i do not see it listed in netstat

in Arris router settings:

	9000-9000	TCP	9000-9000

Netstat says:


i do not have too much experience with netstat so please guide me through it :slight_smile: but it does not seem to be listed
i saw a lone one like this below is this it?


another like it wayy at the top



Where is your server running? On your local machine? Some other machine? What is running on said machine to handle the request on port 9000?


on DESKTOP-SDBT2FF (the living room computer.)

i am using jetbrains Webstorm using the node.js installed socket io 2.0.4 i believe.


and is there a firewall running on the “living room computer”?


there was but just for the sake of this test i turned it off before attempting, and I am still having the same issue.


can you telnet to it?


yes it worked a blank screen was showed in cmd.


@slackmoehrle any other suggestions? telnet worked fine.


I’m not sure. It’s hard to tell you when I don’t know the “living room computer”. Let me see if I can try a test locally some how to verify what should be done. I’m not sure, but perhaps cpp-tests has an example too.


@slackmoehrle yes please run a test locally and if possible could you share that sample code with me and i will attempt to use it and based on what happens then it can help me figure out a solution. When you say “you don’t know the living room computer” are you saying you need computer specifications? if so i can provide some. I am sorry if i was vague or something it’s a rig i built so it does not really have a definite name listed anywhere.


What I mean is I don’t know how it is setup, what is running, etc, etc. It’s not in front of me to troubleshoot. I feel like this issue has something to do with setup and not necessarily code.


@slackmoehrle Windows 10, The network is normal really… I just have Spectrum internet and it is default router settings except for the port 9000 i opened. I haven’t changed anything ive only had it for 4-5 months. Is there any information i could provide to help?


Are you assigning onconnect listener?
Once you get onconnect response, after that try to emit.
Also you can refer to SocketIOTest.cpp in cpp-test, located at cocos2d-x\tests\cpp-tests\Classes\ExtensionsTest\NetworkTest