Revert "Add socket wrapper"

This reverts commit 85e745121f.
This commit is contained in:
Zhi Guan
2022-11-01 17:51:26 +08:00
parent 90aaf5ade1
commit 87081c4ca4
13 changed files with 281 additions and 105 deletions

View File

@@ -12,6 +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>
@@ -37,7 +49,11 @@ int tlcp_client_main(int argc, char *argv[])
char *pass = NULL;
struct hostent *hp;
struct sockaddr_in server;
tls_socket_t sock;
#ifdef WIN32
SOCKET sock;
#else
int sock;
#endif
TLS_CTX ctx;
TLS_CONNECT conn;
char buf[1024] = {0};
@@ -190,7 +206,11 @@ bad:
end:
tls_socket_close(sock);
#ifdef WIN32
closesocket(sock);
#else
close(sock);
#endif
tls_ctx_cleanup(&ctx);
tls_cleanup(&conn);
return 0;