Created
June 6, 2019 06:55
-
-
Save nkenna/c33afa5773cbbfac114927fd9d199f11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static void https_test() | |
{ | |
char *msg = "080022380000008000009A00000530081329000001081329053020390013"; //already prepared 0800 mess | |
char buff[1024]={0}; | |
char recv[1024]={0}; | |
char *ip = "196.6.103.72"; //test ip | |
int port = 5043; | |
int ret = - 1; | |
int sock = 0; | |
char apn[32]="9mobile"; | |
static int prio = 1;//priority connection apn | |
int init_count = 3;//Number of startup and retry times | |
int i; | |
int nret; | |
http_pack(buff, msg); // Package http data | |
sock = 0; // Create sock | |
nret = comm_net_link( "" , apn, 30000); | |
if (nret == 0){ | |
ret = comm_ssl_init(sock ,0,0,0,0); | |
if(ret == 0){ | |
ret = comm_ssl_connect(sock, ip, port); // Connect to http server | |
} | |
} | |
if(ret == 0){ | |
comm_ssl_send(sock , buff , strlen(buff)); // Send http request | |
ret = https_recv(sock, recv, sizeof(recv), 30000); // Receive http response | |
if (ret > 0) | |
{ | |
sprintf(buff, "recv buff:%s", recv); | |
gui_messagebox_show("Https" , buff, "" , "confirm" , 0); | |
} | |
else | |
{ | |
gui_messagebox_show("Https" , "Recv Fail", "" , "confirm" , 0); | |
} | |
} | |
else | |
{ | |
gui_messagebox_show("Https" , "Connect Fail", "" , "confirm" , 0); | |
} | |
comm_ssl_close(sock); | |
comm_net_unlink(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment