I'm usng a library called Lacewing. http://lacewing-project.org/
It uses windows crypt api to make a secure server.
I have created a certificate for my PC (Josh-Laptop), and I used netsh to bind it to port 8012. Lacewing says the certificate is successfully loaded.
Then come the problems. I'm trying to send messages from 1 pc in my house (the host) to another (the client).
When I do not load a certificate and use it in unsafe mode, all messages are sent and received.
void ServerCore::onConnect( Lacewing::Server::Client &client )
{
client.SendWritable("test");
}
...
void ServerCore::onReceive(
Lacewing::Server::Client &client, char * data, int size )
{
getServer().FirstClient()->SendWritable("test");
client.SendWritable("test");
std::cout << data << " was received from " << client.GetAddress().ToString() << std::endl;
}
void ClientCore::onConnect()
{
getClient().Send("test");
}
void ClientCore::onReceive( char * data, int size )
{
getClient().Send("Okay then...");
std::cout << data << std::endl;
}
On the client side, I receive 'test'. On the server side, the library spits out an error saying "hand shake failed", "overlapped io operation is in progress"
This is how I load the certificate:
getServer().LoadSystemCertificate("MY","JOSH-LAPTOP","localmachine");
Why would the handshake fail? Is there something I do not understand? Thanks