对于我的项目,我想从应用程序 (c++) 到 Web服务器 (NodejS) 与 Socket.io 进行通信。
我们之间的联系有效,但是当我发出消息时,什么也没有发生......
客户端(C++)
int main(int argc, char const *argv[])
{
sio::client h;
h.connect("http://x.x.x.x:xxxx");
string mess = "Bonjour !!!";
h.socket()->emit("new message", mess); // Nothing is happening
cout << "Message sended ..." << mess << endl;
...
}
Run Code Online (Sandbox Code Playgroud)
服务器(NodeJ)
...
const io = require('socket.io')(server);
io.on('connection', (socket) => {
console.log("New connexion..."); // It's Work
socket.on('new message', function (data) {
console.log(data); // Never fire
});
});
server.listen(xxxx, () => {
console.log(`Server started on port xxxx`); …Run Code Online (Sandbox Code Playgroud) 我尝试为 arm-poky-linux-gnueabi 交叉编译 zlib,但在启动 make 时出现错误:
...:~/zlib-1.2.11$ AR=$HOST-ar CC=$HOST-gcc RANLIB=$HOST-ranlib ./configure --prefix=$HOME/zlibARM
Checking for shared library support...
Building shared library libz.so.1.2.11 with arm-poky-linux-gnueabi-gcc.
Checking for size_t... Yes.
Checking for off64_t... Yes.
Checking for fseeko... Yes.
Checking for strerror... Yes.
Checking for unistd.h... Yes.
Checking for stdarg.h... Yes.
Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf().
Checking for vsnprintf() in stdio.h... Yes.
Checking for return value of vsnprintf()... Yes.
Checking for attribute(visibility) support... Yes.
...:~/zlib-1.2.11$ make
arm-poky-linux-gnueabi-gcc -O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN …Run Code Online (Sandbox Code Playgroud)