小编Ілл*_*роз的帖子

node js net sockets + websocket without socket.io

我尝试使用node.js创建类似char的东西我是nodejs中的新手,我想在没有socket.io的情况下创建它(我想学习它是如何工作的).这是我正在使用的代码.

var http = require('http');
var net = require('net');


var server = http.createServer(function(req,res){

    res.writeHead(200,{'content-type' : 'text/html'});
    res.write('<a href="./lol/">lol</a><br>');
    res.end('hello world: '+req.url);



    var client = new net.Socket();
    client.connect('7001', '127.0.0.1', function() {

        console.log('CONNECTED TO: ');
        // Write a message to the socket as soon as the client is connected, the server will receive it as message from the client 
        client.write('I am Chuck Norris!');

    });

    // Add a 'data' event handler for the client socket
    // data is what the server sent to …
Run Code Online (Sandbox Code Playgroud)

javascript sockets websocket node.js

13
推荐指数
1
解决办法
4687
查看次数

枚举HWND属性c ++

我正试图从一个获得属性HWND.我使用了" 使用窗口属性"中的信息,但下面的示例对我不起作用.我在编译代码时遇到错误.

类型"BOOL(__stdcall*)(HWND hwndSubclass,LPCSTR lpszString,HANDLE hData)"的参数与"PROPENUMPROCEXW"类型的参数不兼容

这是我的回调函数

BOOL CALLBACK PropEnumProcEx(HWND hwndSubclass, LPCSTR lpszString, HANDLE hData) {
    return TRUE;
}
Run Code Online (Sandbox Code Playgroud)

这就是我如何使用它

EnumPropsEx(hwnd, PropEnumProcEx, NULL);
Run Code Online (Sandbox Code Playgroud)

有人有任何关于如何解决这个问题的建议吗?

c++ winapi hwnd

6
推荐指数
1
解决办法
333
查看次数

标签 统计

c++ ×1

hwnd ×1

javascript ×1

node.js ×1

sockets ×1

websocket ×1

winapi ×1