APNs連線失敗,返回錯誤碼為0

2021-06-02 23:43:02 字數 2047 閱讀 9869

執行的錯誤資訊為:

連線apns伺服器的**如下:

/* load encryption & hashing algorithms for the ssl program */

ssl_library_init();

/* load the error strings for ssl & crypto apis */

ssl_load_error_strings();

/* create an ssl_method structure (choose an ssl/tls protocol version) */

sslcon->meth = sslv3_method();

/* create an ssl_ctx structure */

sslcon->ctx = ssl_ctx_new(sslcon->meth);                        

if(!sslcon->ctx)

/* load the ca from the path */

if(ssl_ctx_load_verify_locations(sslcon->ctx, null, capath) <= 0)

/* load the client certificate into the ssl_ctx structure */

if (ssl_ctx_use_certificate_file(sslcon->ctx, certfile, ssl_filetype_pem) <= 0)

/* load the private-key corresponding to the client certificate */

if (ssl_ctx_use_privatekey_file(sslcon->ctx, keyfile, ssl_filetype_pem) <= 0)

/* check if the client certificate and private-key matches */

if(!ssl_ctx_check_private_key(sslcon->

ctx))

/* set up a tcp socket */

sslcon->sock = socket (pf_inet, sock_stream, ipproto_tcp);       

if(sslcon->sock == -1)

memset (&sslcon->server_addr, '\0', sizeof(sslcon->server_addr));

sslcon->server_addr.sin_family      = af_inet;

sslcon->server_addr.sin_port        = htons(port);      /* server port number */

sslcon->host_info = gethostbyname(host);

if(sslcon->host_info)

else

/* establish a tcp/ip connection to the ssl client */

err = connect(sslcon->sock, (struct sockaddr*) &sslcon->server_addr,sizeof(sslcon->server_addr)); 

if(err == -1)

/* an ssl structure is created */

sslcon->ssl = ssl_new(sslcon->ctx);

if(!sslcon->ssl)

/* assign the socket into the ssl structure (ssl and socket without bio) */

ssl_set_fd(sslcon->ssl, sslcon->sock);

/* perform ssl handshake on the ssl client */

err = ssl_connect(sslcon->ssl);

if(err <= 0)

經過分析確認:

證書有問題。 

http返回錯誤碼

http響應碼響應碼由三位十進位制數字組成,它們出現在由http伺服器傳送的響應的第一行。響應碼分五種型別,由它們的第一位數字表示 1xx 資訊,請求收到,繼續處理 2xx 成功,行為被成功地接受 理解和採納 3xx 重定向,為了完成請求,必須進一步執行的動作 4xx 客戶端錯誤,請求包含語法錯誤或...

載入動態庫失敗,返回126錯誤碼

用loadlibrary實現動態載入類,花了很多時間在dll的路徑問題上。在傳入相對路徑時,檔案的查詢順序比較詭異,在xp sp2以後首先是系統目錄開始搜尋,以前是首先從當前目錄開始搜尋。微軟認為當前目錄是不安全的。所以如果很不巧你的system32下有乙個同名的dll時,會造成dll版本的混亂。解...

wolfSSL connect失敗錯誤碼 188

記錄 wolfssl使用過程中遇到,呼叫wolfssl connect返回值小於0,wolfssl get error得到錯誤碼為 188 wolfcrypt error crypt.h中對錯誤碼定義為 asn no signer e 188,asn no signer to confirm fai...