(Win32)使用套接字连接wss(websocket secure)

时间:2013-11-07 11:49:08

标签: sockets winapi https websocket

在我的Win32应用程序中,我正在尝试使用socket连接websocket(ws:// localhost:3000),如下所示,

 std:string reqLine = "GET /default HTTP/1.1\r\n"             // Request line
 std::string header =  "Connection: Upgrade\r\n"
                       "Sec-WebSocket-Key: GCeEn+pBGdrdj4mcrtBukA==\r\n" 
                       "Sec-WebSocket-Version: 13\r\n"
                       "Upgrade: websocket\r\n"
                       "\r\n";

std::string req = reqLine + header;
::send(m_socket, req, req.size());

Inturn, I am getting response as follows,
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: 4W7fNwDGO1aKNr50PzdRDJaYIGE=

这很好。

现在,我想使用socket连接websocket secure(wss:// localhost:443)。在这种情况下,请求行和标题是什么。

请建议。

0 个答案:

没有答案