TLS server-client in Pike

Siddhant Gupta <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <CAB9YtyH=jfeFrMiW-QA7m6hpKuRQuVPMptQ9sTscg3re+vFffw@mail.gmail.com>
I am trying to implement a server using tcp which has tls wrapped around it.
 This is the code for my server
constant port = 3000;
Stdio.Port mainsock;
SSL.context ctx = SSL.context();
int main(){
mainsock = Stdio.Port();
if(!mainsock->bind(port)){
write("Error");
return 1;
}
Stdio.File sock = mainsock->accept();
SSL.sslfile ssock = SSL.sslfile(sock,ctx);
write(ssock->query_address());
write("\n"+ssock->is_open());
ssock->write("test");
while(1){
string str = Stdio.stdin->gets();
ssock->write(str+"\n");
}
return -1;
}
and this is my client
int main()
{
    Stdio.File sock = Stdio.File();
    sock->connect("127.0.0.1",3000);
    SSL.sslfile ssl = SSL.sslfile(sock, SSL.context());
     write("Response:\n%s\n", ssl->read(1024,1));
}

However I am not getting any message from the server to the client.This
works without tls coming in.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.