mirror of
https://github.com/polhenarejos/pico-keys-sdk
synced 2026-06-11 21:08:16 +02:00
@@ -225,7 +225,7 @@ int main(void) {
|
|||||||
|
|
||||||
//prepare_ccid();
|
//prepare_ccid();
|
||||||
#else
|
#else
|
||||||
emul_init("localhost",35963);
|
emul_init("127.0.0.1",35963);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
random_init();
|
random_init();
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ int msleep(long msec)
|
|||||||
|
|
||||||
int emul_init(char *host, uint16_t port) {
|
int emul_init(char *host, uint16_t port) {
|
||||||
struct sockaddr_in serv_addr;
|
struct sockaddr_in serv_addr;
|
||||||
printf("\n Starting emulation envionrment\n");
|
fprintf(stderr, "\n Starting emulation envionrment\n");
|
||||||
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||||
printf("\n Socket creation error \n");
|
fprintf(stderr, "\n Socket creation error \n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,12 +68,12 @@ int emul_init(char *host, uint16_t port) {
|
|||||||
// Convert IPv4 and IPv6 addresses from text to binary
|
// Convert IPv4 and IPv6 addresses from text to binary
|
||||||
// form
|
// form
|
||||||
if (inet_pton(AF_INET, host, &serv_addr.sin_addr) <= 0) {
|
if (inet_pton(AF_INET, host, &serv_addr.sin_addr) <= 0) {
|
||||||
printf("\nInvalid address/ Address not supported \n");
|
fprintf(stderr, "\nInvalid address/ Address not supported \n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connect(sock, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
|
if (connect(sock, (struct sockaddr*)&serv_addr, sizeof(serv_addr)) < 0) {
|
||||||
printf("\nConnection Failed \n");
|
fprintf(stderr, "\nConnection Failed \n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int x = fcntl(sock ,F_GETFL, 0);
|
int x = fcntl(sock ,F_GETFL, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user