последовательное чтение строки в сокете сервера с использованием языка c - PullRequest
0 голосов
/ 11 декабря 2018
             x_hex=(char*)malloc(sizeof(char)*65);
             bzero(x_hex,65);
             check= read(newsockfd,x_hex,65);
             if ( check < 0)
             error("ERROR reading from socket");
             printf("Bytes recieved: %d\n", check);
             printf("x_hex is %s\n",x_hex);
             BN_hex2bn(&x, x_hex);
             free(x_hex);

             //second read

             y_hex=(char*)malloc(sizeof(char)*65);
             bzero(y_hex,65);
             check= read(newsockfd,y_hex,65);
             if ( check < 0)
                error("ERROR reading from socket");
             printf("Bytes recieved: %d\n", check);
             printf("y_hex  %s\n", y_hex);
             BN_hex2bn(&y, y_hex);
             free(y_hex);

Вывод ->

// Вывод должен быть 64 для x, но здесь я получил только 1?

Bytes recieved: 1
comit1_x_hex from EV driver is 

Bytes recieved: 64
comit1_y_hex from EV driver is 
f0c8ff0cb9872942bc604523cb15243eafe12dc1bdd20339258f2d4eb0bcf1b9
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...