mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-06 16:36:16 +08:00
Add Windows and Visual Studio support
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
@@ -12,12 +12,18 @@
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef WIN32
|
||||
// FIMXE: socket related headers should be moved to tls.h
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/types.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include <gmssl/tls.h>
|
||||
#include <gmssl/error.h>
|
||||
|
||||
@@ -95,7 +101,7 @@ bad:
|
||||
return -1;
|
||||
}
|
||||
if (!(hp = gethostbyname(host))) {
|
||||
herror("tlcp_client: '-host' invalid");
|
||||
//herror("tlcp_client: '-host' invalid");
|
||||
goto end;
|
||||
}
|
||||
|
||||
@@ -149,7 +155,7 @@ bad:
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(conn.sock, &fds);
|
||||
FD_SET(STDIN_FILENO, &fds);
|
||||
FD_SET(fileno(stdin), &fds); //FD_SET(STDIN_FILENO, &fds);
|
||||
|
||||
if (select(conn.sock + 1, &fds, NULL, NULL, NULL) < 0) {
|
||||
fprintf(stderr, "%s: select failed\n", prog);
|
||||
@@ -172,7 +178,7 @@ bad:
|
||||
}
|
||||
|
||||
}
|
||||
if (FD_ISSET(STDIN_FILENO, &fds)) {
|
||||
if (FD_ISSET(fileno(stdin), &fds)) {
|
||||
fprintf(stderr, "recv from stdin\n");
|
||||
|
||||
memset(send_buf, 0, sizeof(send_buf));
|
||||
|
||||
Reference in New Issue
Block a user