| | |
| | | // return sockt->bind(key); |
| | | } |
| | | |
| | | int net_mod_socket_reg(void *_socket, void *pData, int len, void **buf, int *size, const int timeout_ms, int flag) |
| | | { |
| | | NetModSocket *sockt = (NetModSocket *)_socket; |
| | | |
| | | return sockt->reg(pData, len, buf, size, timeout_ms, flag); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 发送信息 |
| | | * @key 发送给谁 |
| | |
| | | */ |
| | | int net_mod_socket_sendto(void *_socket, const void *buf, const int size, const int key) { |
| | | NetModSocket *sockt = (NetModSocket *)_socket; |
| | | logger->debug("net_mod_socket_sendto: %d sendto %d", net_mod_socket_get_key(_socket), key); |
| | | return sockt->sendto(buf, size, key); |
| | | } |
| | | // 发送信息超时返回。 @sec 秒 , @nsec 纳秒 |
| | | int net_mod_socket_sendto_timeout(void *_socket, const void *buf, const int size, const int key, int sec, int nsec){ |
| | | NetModSocket *sockt = (NetModSocket *)_socket; |
| | | logger->debug("net_mod_socket_sendto: %d sendto %d", net_mod_socket_get_key(_socket), key); |
| | | return sockt->sendto_timeout(buf, size, key, sec, nsec); |
| | | // return sockt->sendto(buf, size, key); |
| | | } |
| | | // 发送信息立刻返回。 |
| | | int net_mod_socket_sendto_nowait(void *_socket, const void *buf, const int size, const int key){ |
| | | NetModSocket *sockt = (NetModSocket *)_socket; |
| | | logger->debug("net_mod_socket_sendto: %d sendto %d", net_mod_socket_get_key(_socket), key); |
| | | return sockt->sendto_nowait(buf, size, key); |
| | | } |
| | | |
| | |
| | | int rv; |
| | | NetModSocket *sockt = (NetModSocket *)_socket; |
| | | |
| | | logger->debug(" %d net_mod_socket_recvfrom before", net_mod_socket_get_key(_socket)); |
| | | rv = sockt->recvfrom(buf, size, key); |
| | | logger->debug(" %d net_mod_socket_recvfrom after. rv = %d", net_mod_socket_get_key(_socket), rv); |
| | | return rv; |
| | | } |
| | | |
| | | // 接受信息超时返回。 @sec 秒 , @nsec 纳秒 |
| | | int net_mod_socket_recvfrom_timeout(void *_socket, void **buf, int *size, int *key, int sec, int nsec){ |
| | | NetModSocket *sockt = (NetModSocket *)_socket; |
| | | // return sockt->recvfrom(buf, size, key); |
| | | return sockt->recvfrom_timeout(buf, size, key, sec, nsec); |
| | | NetModSocket *sockt = (NetModSocket *)_socket; |
| | | return sockt->recvfrom_timeout(buf, size, key, sec, nsec); |
| | | } |
| | | |
| | | int net_mod_socket_recvfrom_nowait(void *_socket, void **buf, int *size, int *key){ |
| | | NetModSocket *sockt = (NetModSocket *)_socket; |
| | | return sockt->recvfrom_nowait(buf, size, key); |
| | | NetModSocket *sockt = (NetModSocket *)_socket; |
| | | return sockt->recvfrom_nowait(buf, size, key); |
| | | } |
| | | |
| | | int net_mod_socket_sendandrecv(void *_socket, net_node_t *node_arr, int arrlen, void *send_buf, int send_size, |
| | |
| | | return sockt->sendandrecv(node_arr, arrlen, send_buf, send_size, recv_arr, recv_arr_size, err_arr, err_arr_size, -1); |
| | | } |
| | | |
| | | int net_mod_socket_bind_proc_id(void * _socket, char *proc_id, int len){ |
| | | NetModSocket *sockt = (NetModSocket *)_socket; |
| | | return sockt->bind_proc_id(proc_id, len); |
| | | } |
| | | |
| | | /** |
| | | * 如果建立连接的节点没有接受到消息等待timeout的时间后返回 |
| | | * @timeout 等待时间,单位是千分之一秒 |