BIO_do_connect fails, returns negative value

后端 未结 1 1870
陌清茗
陌清茗 2021-01-23 15:25

I am trying and using OpenSSL in C (on ubuntu 12.04). Took an example from here.

Everything goes well until BIO_do_connect() which returns a negative value. Probably I d

相关标签:
1条回答
  • 2021-01-23 16:16

    BIO_set_conn_ip() sets the IP address to ip using binary form, that is four bytes specifying the IP address in big-endian form. You are trying to write the IP in the little-endian form. Change the order of bytes like this:

    ip[3] = 0b11000000;
    ip[2] = 0b10100100;
    ip[1] = 0b1;
    ip[0] = 0b1110100;
    

    Also, the IP you are trying to set is 192.164.1.116 which might be wrong if you were going for 192.168.1.116 (mind the 168 vs 164 part).

    0 讨论(0)
提交回复
热议问题