vfa-kinnd / libjingle

Automatically exported from code.google.com/p/libjingle
0 stars 0 forks source link

How to make TLS enable socket communication using talk_base::Win32Socket #451

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I am using libjingle libraries to create a WebRTC application by going through 
peerconnection_client sample.
In my application, I am connecting with a websocket server as follows,

- Created a socket as follows,
talk_base::Win32Socket* sock = new talk_base::Win32Socket();
sock->CreateT(family, SOCK_STREAM);

- Connect socket as follows, server_address_ has IP and port.
control_socket_.reset(CreateClientSocket(server_address_.ipaddr().family()));

- On getting the call in OnConnect(talk_base::AsyncSocket* socket), I am 
sending data

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

size_t sent = socket->Send(onConnectMessage.c_str(), onConnectMessage.length());

Now my application is connected to ws server( ws://localhost:3000). And I can 
receive messages in OnRead(talk_base::AsyncSocket* socket) callback onward.

- Now, I am trying to connect with wss://localhost:443, but couldn't make it 
work. I am getting call in OnConnect callback and sending data but fail to 
handshake since server is expecting a tls connection. I don't want to use any 
other third party library for websocket connection.
I tried number of thing but failed.

Could you Please tell me how I can do so? Is libjingle/webrtc provide a way to 
connect using https/wss protocol?
How can I call a https webservice using talk_base::Win32Socket().

Please Help! I am stuck.

Original issue reported on code.google.com by er.rudr...@gmail.com on 15 Nov 2013 at 7:19