From 5e9d03d507aad324a803eb8795e0eed6fb671761 Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Mon, 10 Jul 2023 15:24:52 +0800
Subject: [PATCH] Merge branch 'master' of http://master.iot-yun.club:8088/r/raspberrypi
---
apue/project_socket/src/socket.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/apue/project_socket/src/socket.c b/apue/project_socket/src/socket.c
index 677a3cc..e6231e3 100644
--- a/apue/project_socket/src/socket.c
+++ b/apue/project_socket/src/socket.c
@@ -41,13 +41,14 @@
*/
int socket_init(socket_ctx_t *sock, char *host, int port)
{
- if( !sock || !host || port<=0 )
+ if( !sock || port<=0 )
return -1;
memset( sock, 0, sizeof(*sock) );
sock->fd = -1;
- strncpy(sock->host, host, HOSTNAME_LEN);
sock->port = port;
+ if( host ) /* server no need it */
+ strncpy(sock->host, host, HOSTNAME_LEN);
}
/* description: close socket
@@ -83,6 +84,7 @@
if( !sock )
return -1;
+ set_socket_rlimit(); /* set max open socket count */
}
/* description: socket connect to server in block mode
--
Gitblit v1.9.1