1

Lacewing 库应该支持托管安全服务器。

它说如果证书加载正确,它应该是安全的。但是,我正在托管它,它说证书已成功加载,但是当我从客户端向服务器发送消息时,我没有收到它。如果没有加载证书,我会这样做。

#include <string>
#include <iostream>  
#define  LacewingFunction
#include "Lacewing.h"

void onReceive (Lacewing::Server &Server, Lacewing::Server::Client &Client,
                char * Data, int Size) {
                    /* callback body */
                    std::cout << Data << "\n";
}

void onConnect (Lacewing::Server &Server, Lacewing::Server::Client &Client)
{
    std::cout << "Connected!" << "\n";
    Client.Send("TestingS");
}



void onReceiveC (Lacewing::Client &Client, char * Data, int Size)
{
    std::cout << Data << "\n";
    Client.Send("TesingC");
}


int main(int argc, char* argv[])  
{  
    std::string s;
    std::cin >> s;
    if(s == "server")
    {
        Lacewing::EventPump pump;
        Lacewing::Server* server = new Lacewing::Server(pump);
        server->LoadSystemCertificate("MY","localhost");
        std::cout << server->CertificateLoaded();
        server->onReceive(onReceive);
        server->onConnect(onConnect);
        server->Host(1234);
        std::cout << server->CertificateLoaded();
        pump.StartEventLoop();
    }
    else
    {
        Lacewing::EventPump pump;
        Lacewing::Client* server = new Lacewing::Client(pump);
        server->onReceive(onReceiveC);
        server->Connect("192.168.2.12",1234);
        pump.StartEventLoop();
    }

    return 0;  
}  

两次证书都说它已加载。

这是api文档。 http://lacewing-project.org/docs/server/LoadSystemCertificate.html

谢谢

也许makecert生成的证书不起作用?有人有证书我可以试试吗?

4

1 回答 1

1

我正在尝试同样的事情。

bSecure = WebServer.LoadSystemCertificate("My", "localhost","localmachine");
bSecure = WebServer.CertificateLoaded();

两者都是正确的,因此应该加载证书。

看这里:如何制作证书

这在 IE9 中运行良好,端口设置为 5040。 https://localhost:5040/ 它在 Firefox 或 Chrome 中不起作用,但这与加载“认证机构”证书有关。

于 2012-05-14T10:18:39.347 回答