From d26e81c4213dfb04391c7b6692f243aede2e6895 Mon Sep 17 00:00:00 2001 From: wangzhengquan <wangzhengquan85@126.com> Date: 星期一, 12 十月 2020 15:25:31 +0800 Subject: [PATCH] version --- src/socket/net_mod_socket.h | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 41 insertions(+), 4 deletions(-) diff --git a/src/socket/net_mod_socket.h b/src/socket/net_mod_socket.h index 7ce98dc..4ace2bb 100644 --- a/src/socket/net_mod_socket.h +++ b/src/socket/net_mod_socket.h @@ -3,15 +3,52 @@ #include "usg_common.h" #include "shm_mod_socket.h" #include "socket_io.h" + +struct net_node_t +{ + const char *host; + int port; + int key; +}; + + +struct net_mod_request_head_t { + socket_mod_t mod; + int key; + uint32_t content_length; +}; + +struct net_mod_response_head_t { + // socket_mod_t mod; + // int key; + uint32_t content_length; +}; + + +struct net_mod_recv_msg_t +{ + char host[128]; + int port; + int key; + void *content; + uint32_t content_length; + +}; + class NetModSocket { private: - int clientfd; - rio_t rio; + static std::map<std::string, rio_t *> connectionMap; + ShmModSocket shmModSocket; public: - NetModSocket(const char *host, int port); - ssize_t send(void *buf, size_t size); + + NetModSocket(); + int sendandrecv(net_node_t *node_arr, int arrlen, void *send_buf, int send_size, + net_mod_recv_msg_t ** resp_arr, int *resp_arr_size); + ~NetModSocket(); + + static void free_recv_msg_arr(net_mod_recv_msg_t * arr, size_t size); }; -- Gitblit v1.8.0