修改网络的初始化,异步支持问题

This commit is contained in:
2026-07-21 01:22:09 +08:00
parent fbe0726991
commit f50b9c9e66
7 changed files with 337 additions and 138 deletions

View File

@@ -27,6 +27,8 @@ typedef enum {
NET_MSG_RECV,
NET_MSG_CLOSE,
NET_MSG_CONNECT,
NET_MSG_LISTEN,
NET_MSG_ACCEPT,
} net_msg_type_t;
typedef struct {
@@ -318,6 +320,15 @@ int net_recv_sock(net_sock_t *p_sock, void *buf, int len, int flags);
*/
int net_close_sock(net_sock_t *p_sock);
/*
* 函数功能:启动 TCP Server 监听(内部版本,直接操作,不经过消息队列)
* 入口参数sockfd - Socket 描述符
* backlog - 数据 Socket 数量0=单连接模式)
* 返回值0 成功,-1 失败
* 限定条件:必须在 netTask 上下文中调用
*/
int net_listen_locked(int sockfd, int backlog);
#ifdef __cplusplus
}
#endif