Re: TLS server-client in Pike

Siddhant Gupta <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <CAB9YtyEGdqJ-3bUr5h=unG4eZMMB74tMygwrsihchoahQJFrjQ@mail.gmail.com>
Yes, it is working. Thanks guys. I appreciate your support.

On Thu, Jun 2, 2016 at 11:40 PM Henrik Grubbström <[email protected]> wrote:

> On Thu, 2 Jun 2016, Siddhant Gupta wrote:
>
> > I changed my client to set it to blocking. I have updated the code on
> > github. I will post it here also for youe quick reference.
> > int main()
> > {
> >   Stdio.FILE sock = Stdio.FILE();
> >   if(!sock->connect("127.0.0.1", 443)){
> > write(strerror(sock->errno()));
> > }
> > SSL.context ctx = SSL.context();
> >    SSL.sslfile ssl = SSL.sslfile(sock,ctx,1,1);
> >    ssl->set_blocking();
> > //   ssl->connect();
> >    ssl->write("GET / HTTP/1.1\r\n\r\n");
> > string str = ssl->read(1024,1);
> > write("Response:\n%s\n",str);
> > return -1;
> > }
> > I am getting a response from the server but also an error message after
> > that.
> > Cannot use nonblocking IO with buffered files.
> > /usr/local/pike/7.8.866/lib/modules/Stdio.pmod/module.pmod:1955:
> >    Stdio.FILE("socket", "127.0.0.1:443", 777 /* fd=10
> > */)->set_nonblocking()
>
> The problem here is that you are using a Stdio.FILE and not a Stdio.File.
> Stdio.FILE does not support nonblocking I/O (which SSL.File uses
> internally).
>
>         /grubba
>
> --
> Henrik Grubbström                                       [email protected]
> Roxen Internet Software AB
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.