wangzhengquan
2020-11-27 973ea7eaee914ba2e296d97bdb0457b6732891e1
update
1个文件已添加
6个文件已修改
329 ■■■■ 已修改文件
lib/libusgcommon.so 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/dgram_mod_socket.c 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/dgram_mod_socket.h 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_server_socket.c 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_socket.c 92 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_socket.h 52 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_socket_wrapper.h 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/libusgcommon.so
Binary files differ
src/socket/dgram_mod_socket.c
@@ -41,81 +41,81 @@
 * 绑定端口到socket, 如果不绑定则系统自动分配一个
 * @return 0 成功, 其他值 失败的错误码
*/
int dgram_mod_bind(void * _socket, int port) {
int dgram_mod_bind(void * _socket, int key) {
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->bind(port);
    return socket->m_socket->bind(key);
}
/**
 * 强制绑定端口到socket, 适用于程序非正常关闭的情况下,重启程序绑定原来还没释放的key
 * @return 0 成功, 其他值 失败的错误码
*/
int dgram_mod_force_bind(void * _socket, int port) {
int dgram_mod_force_bind(void * _socket, int key) {
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->force_bind(port);
    return socket->m_socket->force_bind(key);
}
/**
 * 发送信息
 * @port 发送给谁
 * @key 发送给谁
 * @return 0 成功, 其他值 失败的错误码
 */
int dgram_mod_sendto(void *_socket, const void *buf, const int size, const int port){
int dgram_mod_sendto(void *_socket, const void *buf, const int size, const int key){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->sendto(buf, size,port);
    return socket->m_socket->sendto(buf, size,key);
}
// 发送信息超时返回。 @sec 秒 , @nsec 纳秒
int dgram_mod_sendto_timeout(void *_socket, const void *buf, const int size, const int port, int sec, int nsec){
int dgram_mod_sendto_timeout(void *_socket, const void *buf, const int size, const int key, int sec, int nsec){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    struct timespec timeout = {sec, nsec};
    return socket->m_socket->sendto_timeout(buf, size, port, &timeout);
    return socket->m_socket->sendto_timeout(buf, size, key, &timeout);
}
// 发送信息立刻返回。
int dgram_mod_sendto_nowait(void *_socket, const void *buf, const int size, const int port){
int dgram_mod_sendto_nowait(void *_socket, const void *buf, const int size, const int key){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->sendto_nowait(buf, size,port);
    return socket->m_socket->sendto_nowait(buf, size,key);
}
/**
 * 接收信息
 * @port 从谁哪里收到的信息
 * @key 从谁哪里收到的信息
 * @return 0 成功, 其他值 失败的错误码
*/
int dgram_mod_recvfrom(void *_socket, void **buf, int *size, int *port) {
int dgram_mod_recvfrom(void *_socket, void **buf, int *size, int *key) {
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->recvfrom(buf, size, port);
    return socket->m_socket->recvfrom(buf, size, key);
}
// 接受信息超时返回。 @sec 秒 , @nsec 纳秒
int dgram_mod_recvfrom_timeout(void *_socket, void **buf, int *size, int *port, int sec, int nsec){
int dgram_mod_recvfrom_timeout(void *_socket, void **buf, int *size, int *key, int sec, int nsec){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    struct timespec timeout = {sec, nsec};
    return socket->m_socket->recvfrom_timeout(buf, size, port, &timeout);
    return socket->m_socket->recvfrom_timeout(buf, size, key, &timeout);
}
int dgram_mod_recvfrom_nowait(void *_socket, void **buf, int *size, int *port){
int dgram_mod_recvfrom_nowait(void *_socket, void **buf, int *size, int *key){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->recvfrom_nowait(buf, size, port);
    return socket->m_socket->recvfrom_nowait(buf, size, key);
}
/**
 * 发送请求信息并等待接收应答
 * @port 发送给谁
 * @key 发送给谁
 * @return 0 成功, 其他值 失败的错误码
*/
int dgram_mod_sendandrecv(void * _socket, const void *send_buf, const int send_size, const int port, void **recv_buf, int *recv_size){
int dgram_mod_sendandrecv(void * _socket, const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->sendandrecv(send_buf, send_size, port, recv_buf, recv_size);
    return socket->m_socket->sendandrecv(send_buf, send_size, key, recv_buf, recv_size);
}
// 超时返回。 @sec 秒 , @nsec 纳秒
int dgram_mod_sendandrecv_timeout(void * _socket, const void *send_buf, const int send_size, const int port, void **recv_buf, int *recv_size, int sec, int nsec){
int dgram_mod_sendandrecv_timeout(void * _socket, const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size, int sec, int nsec){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    struct timespec timeout = {sec, nsec};
    return socket->m_socket->sendandrecv_timeout(send_buf, send_size, port, recv_buf, recv_size, &timeout);
    return socket->m_socket->sendandrecv_timeout(send_buf, send_size, key, recv_buf, recv_size, &timeout);
}
int dgram_mod_sendandrecv_nowait(void * _socket, const void *send_buf, const int send_size, const int port, void **recv_buf, int *recv_size) {
int dgram_mod_sendandrecv_nowait(void * _socket, const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size) {
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->sendandrecv_nowait(send_buf, send_size, port, recv_buf, recv_size);
    return socket->m_socket->sendandrecv_nowait(send_buf, send_size, key, recv_buf, recv_size);
}
@@ -133,21 +133,21 @@
 * 订阅指定主题
 * @topic 主题
 * @size 主题长度
 * @port 总线端口
 * @key 总线端口
 */
int  dgram_mod_sub(void * _socket, void *topic, int size, int port){
int  dgram_mod_sub(void * _socket, void *topic, int size, int key){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->sub((char *)topic,  size,  port);
    return socket->m_socket->sub((char *)topic,  size,  key);
}
// 超时返回。 @sec 秒 , @nsec 纳秒
int  dgram_mod_sub_timeout(void * _socket, void *topic, int size, int port, int sec, int nsec){
int  dgram_mod_sub_timeout(void * _socket, void *topic, int size, int key, int sec, int nsec){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    struct timespec timeout = {sec, nsec};
    return socket->m_socket->sub_timeout((char *)topic,  size,  port, &timeout);
    return socket->m_socket->sub_timeout((char *)topic,  size,  key, &timeout);
}
int  dgram_mod_sub_nowait(void * _socket, void *topic, int size, int port){
int  dgram_mod_sub_nowait(void * _socket, void *topic, int size, int key){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->sub_nowait((char *)topic,  size,  port);
    return socket->m_socket->sub_nowait((char *)topic,  size,  key);
}
@@ -156,21 +156,21 @@
 * 取消订阅指定主题
 * @topic 主题
 * @size 主题长度
 * @port 总线端口
 * @key 总线端口
 */
int  dgram_mod_desub(void * _socket, void *topic, int size, int port){
int  dgram_mod_desub(void * _socket, void *topic, int size, int key){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->desub((char *)topic,  size,  port);
    return socket->m_socket->desub((char *)topic,  size,  key);
}
// 超时返回。 @sec 秒 , @nsec 纳秒
int  dgram_mod_desub_timeout(void * _socket, void *topic, int size, int port, int sec, int nsec){
int  dgram_mod_desub_timeout(void * _socket, void *topic, int size, int key, int sec, int nsec){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    struct timespec timeout = {sec, nsec};
    return socket->m_socket->desub_timeout((char *)topic,  size,  port, &timeout);
    return socket->m_socket->desub_timeout((char *)topic,  size,  key, &timeout);
}
int  dgram_mod_desub_nowait(void * _socket, void *topic, int size, int port){
int  dgram_mod_desub_nowait(void * _socket, void *topic, int size, int key){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->desub_nowait((char *)topic,  size,  port);
    return socket->m_socket->desub_nowait((char *)topic,  size,  key);
}
@@ -179,26 +179,26 @@
 * 发布主题
 * @topic 主题
 * @content 主题内容
 * @port 总线端口
 * @key 总线端口
 */
int  dgram_mod_pub(void * _socket, void *topic, int topic_size, void *content, int content_size, int port){
int  dgram_mod_pub(void * _socket, void *topic, int topic_size, void *content, int content_size, int key){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->pub((char *)topic, topic_size, content, content_size, port);
    return socket->m_socket->pub((char *)topic, topic_size, content, content_size, key);
}
//  超时返回。 @sec 秒 , @nsec 纳秒
int  dgram_mod_pub_timeout(void * _socket, void *topic, int topic_size, void *content, int content_size, int port, int sec, int nsec){
int  dgram_mod_pub_timeout(void * _socket, void *topic, int topic_size, void *content, int content_size, int key, int sec, int nsec){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    struct timespec timeout = {sec, nsec};
    return socket->m_socket->pub_timeout((char *)topic, topic_size, content, content_size, port, &timeout);
    return socket->m_socket->pub_timeout((char *)topic, topic_size, content, content_size, key, &timeout);
}
int  dgram_mod_pub_nowait(void * _socket, void *topic, int topic_size, void *content, int content_size, int port){
int  dgram_mod_pub_nowait(void * _socket, void *topic, int topic_size, void *content, int content_size, int key){
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
    return socket->m_socket->pub_nowait((char *)topic, topic_size, content, content_size, port);
    return socket->m_socket->pub_nowait((char *)topic, topic_size, content, content_size, key);
}
/**
 * 获取soket端口号
 * 获取soket key
 */
int dgram_mod_get_port(void * _socket) {
    dgram_mod_socket_t * socket = (dgram_mod_socket_t *) _socket;
src/socket/dgram_mod_socket.h
@@ -33,43 +33,43 @@
 * 绑定端口到socket, 如果不绑定则系统自动分配一个
 * @return 0 成功, 其他值 失败的错误码
*/
int dgram_mod_bind(void * _socket, int port);
int dgram_mod_bind(void * _socket, int key);
/**
 * 强制绑定端口到socket, 适用于程序非正常关闭的情况下,重启程序绑定原来还没释放的key
 * @return 0 成功, 其他值 失败的错误码
*/
int dgram_mod_force_bind(void * _socket, int port);
int dgram_mod_force_bind(void * _socket, int key);
/**
 * 发送信息
 * @port 发送给谁
 * @key 发送给谁
 * @return 0 成功, 其他值 失败的错误码
 */
int dgram_mod_sendto(void *_socket, const void *buf, const int size, const int port);
int dgram_mod_sendto(void *_socket, const void *buf, const int size, const int key);
// 发送信息超时返回。 @sec 秒 , @nsec 纳秒
int dgram_mod_sendto_timeout(void *_socket, const void *buf, const int size, const int port, int sec, int nsec);
int dgram_mod_sendto_timeout(void *_socket, const void *buf, const int size, const int key, int sec, int nsec);
// 发送信息立刻返回。
int dgram_mod_sendto_nowait(void *_socket, const void *buf, const int size, const int port);
int dgram_mod_sendto_nowait(void *_socket, const void *buf, const int size, const int key);
/**
 * 接收信息
 * @port 从谁哪里收到的信息
 * @key 从谁哪里收到的信息
 * @return 0 成功, 其他值 失败的错误码
*/
int dgram_mod_recvfrom(void *_socket, void **buf, int *size, int *port);
int dgram_mod_recvfrom(void *_socket, void **buf, int *size, int *key);
// 接受信息超时返回。 @sec 秒 , @nsec 纳秒
int dgram_mod_recvfrom_timeout(void *_socket, void **buf, int *size, int *port, int sec, int nsec);
int dgram_mod_recvfrom_nowait(void *_socket, void **buf, int *size, int *port);
int dgram_mod_recvfrom_timeout(void *_socket, void **buf, int *size, int *key, int sec, int nsec);
int dgram_mod_recvfrom_nowait(void *_socket, void **buf, int *size, int *key);
/**
 * 发送请求信息并等待接收应答
 * @port 发送给谁
 * @key 发送给谁
 * @return 0 成功, 其他值 失败的错误码
*/
int dgram_mod_sendandrecv(void * _socket, const void *send_buf, const int send_size, const int send_port, void **recv_buf, int *recv_size) ;
int dgram_mod_sendandrecv(void * _socket, const void *send_buf, const int send_size, const int send_key, void **recv_buf, int *recv_size) ;
// 超时返回。 @sec 秒 , @nsec 纳秒
int dgram_mod_sendandrecv_timeout(void * _socket, const void *send_buf, const int send_size, const int send_port, void **recv_buf, int *recv_size, int sec, int nsec) ;
int dgram_mod_sendandrecv_nowait(void * _socket, const void *send_buf, const int send_size, const int send_port, void **recv_buf, int *recv_size) ;
int dgram_mod_sendandrecv_timeout(void * _socket, const void *send_buf, const int send_size, const int send_key, void **recv_buf, int *recv_size, int sec, int nsec) ;
int dgram_mod_sendandrecv_nowait(void * _socket, const void *send_buf, const int send_size, const int send_key, void **recv_buf, int *recv_size) ;
/**
@@ -83,35 +83,35 @@
 * 订阅指定主题
 * @topic 主题
 * @size 主题长度
 * @port 总线端口
 * @key 总线端口
 */
int  dgram_mod_sub(void * _socket, void *topic, int size, int port);
int  dgram_mod_sub(void * _socket, void *topic, int size, int key);
// 超时返回。 @sec 秒 , @nsec 纳秒
int  dgram_mod_sub_timeout(void * _socket, void *topic, int size, int port, int sec, int nsec);
int  dgram_mod_sub_nowait(void * _socket, void *topic, int size, int port);
int  dgram_mod_sub_timeout(void * _socket, void *topic, int size, int key, int sec, int nsec);
int  dgram_mod_sub_nowait(void * _socket, void *topic, int size, int key);
/**
 * 取消订阅指定主题
 * @topic 主题,主题为空时取消全部订阅
 * @size 主题长度
 * @port 总线端口
 * @key 总线端口
 */
int  dgram_mod_desub(void * _socket, void *topic, int size, int port);
int  dgram_mod_desub(void * _socket, void *topic, int size, int key);
// 超时返回。 @sec 秒 , @nsec 纳秒
int  dgram_mod_desub_timeout(void * _socket, void *topic, int size, int port, int sec, int nsec);
int  dgram_mod_desub_nowait(void * _socket, void *topic, int size, int port);
int  dgram_mod_desub_timeout(void * _socket, void *topic, int size, int key, int sec, int nsec);
int  dgram_mod_desub_nowait(void * _socket, void *topic, int size, int key);
/**
 * 发布主题
 * @topic 主题
 * @content 主题内容
 * @port 总线端口
 * @key 总线端口
 */
int  dgram_mod_pub(void * _socket, void *topic, int topic_size, void *content, int content_size, int port);
int  dgram_mod_pub(void * _socket, void *topic, int topic_size, void *content, int content_size, int key);
//  超时返回。 @sec 秒 , @nsec 纳秒
int  dgram_mod_pub_timeout(void * _socket, void *topic, int topic_size, void *content, int content_size, int port, int sec, int nsec);
int  dgram_mod_pub_nowait(void * _socket, void *topic, int topic_size, void *content, int content_size, int port);
int  dgram_mod_pub_timeout(void * _socket, void *topic, int topic_size, void *content, int content_size, int key, int sec, int nsec);
int  dgram_mod_pub_nowait(void * _socket, void *topic, int topic_size, void *content, int content_size, int key);
/**
src/socket/net_mod_server_socket.c
@@ -4,6 +4,8 @@
#include "net_mod_socket_io.h"
#include "net_mod_socket.h"
 
static  Logger * logger = LoggerFactory::getLogger();
NetModServerSocket::NetModServerSocket(int _port): listenfd(0), port(_port), max_buf(1024), max_topic_buf(256), max_response_buf(1024)
{
  
@@ -190,6 +192,7 @@
    
   
  } else if(request_head.mod == BUS) {
    // TODO: pub response
    if(request_head.topic_length > max_topic_buf) {
      if( (topic_buf = realloc(topic_buf, request_head.topic_length)) == NULL ) {
         LoggerFactory::getLogger()->error(errno, "NetModServerSocket::process_client realloc topic_buf");
@@ -214,8 +217,6 @@
void  NetModServerSocket::check_clients()
{
  int i, connfd;
  //rio_t *rio;
  Logger * logger = LoggerFactory::getLogger();
  for (i = 0; (i <= pool.maxi) && (pool.nready > 0); i++)
  {
src/socket/net_mod_socket.c
@@ -28,16 +28,16 @@
 * 绑定端口到socket, 如果不绑定则系统自动分配一个
 * @return 0 成功, 其他值 失败的错误码
*/
int NetModSocket::bind(int port) {
  return shmModSocket.bind(port);
int NetModSocket::bind(int key) {
  return shmModSocket.bind(key);
}
/**
 * 强制绑定端口到socket, 适用于程序非正常关闭的情况下,重启程序绑定原来还没释放的key
 * @return 0 成功, 其他值 失败的错误码
*/
int NetModSocket::force_bind( int port) {
  return shmModSocket.force_bind(port);
int NetModSocket::force_bind( int key) {
  return shmModSocket.force_bind(key);
}
int NetModSocket::sendandrecv(net_node_t *node_arr, int arrlen, void *send_buf, int send_size, 
@@ -373,57 +373,57 @@
/**
 * 发送信息
 * @port 发送给谁
 * @key 发送给谁
 * @return 0 成功, 其他值 失败的错误码
 */
int NetModSocket::sendto(const void *buf, const int size, const int port){
  return shmModSocket.sendto(buf, size,port);
int NetModSocket::sendto(const void *buf, const int size, const int key){
  return shmModSocket.sendto(buf, size, key);
}
// 发送信息超时返回。 @sec 秒 , @nsec 纳秒
int NetModSocket::sendto_timeout(const void *buf, const int size, const int port, int sec, int nsec){
int NetModSocket::sendto_timeout(const void *buf, const int size, const int key, int sec, int nsec){
  struct timespec timeout = {sec, nsec};
  return shmModSocket.sendto_timeout(buf, size, port, &timeout);
  return shmModSocket.sendto_timeout(buf, size, key, &timeout);
}
// 发送信息立刻返回。
int NetModSocket::sendto_nowait(const void *buf, const int size, const int port){
  return shmModSocket.sendto_nowait(buf, size,port);
int NetModSocket::sendto_nowait(const void *buf, const int size, const int key){
  return shmModSocket.sendto_nowait(buf, size, key);
}
/**
 * 接收信息
 * @port 从谁哪里收到的信息
 * @key 从谁哪里收到的信息
 * @return 0 成功, 其他值 失败的错误码
*/
int NetModSocket::recvfrom(void **buf, int *size, int *port) {
  return shmModSocket.recvfrom(buf, size, port);
int NetModSocket::recvfrom(void **buf, int *size, int *key) {
  return shmModSocket.recvfrom(buf, size, key);
}
// 接受信息超时返回。 @sec 秒 , @nsec 纳秒
int NetModSocket::recvfrom_timeout(void **buf, int *size, int *port, int sec, int nsec){
int NetModSocket::recvfrom_timeout(void **buf, int *size, int *key, int sec, int nsec){
  struct timespec timeout = {sec, nsec};
  return shmModSocket.recvfrom_timeout(buf, size, port, &timeout);
  return shmModSocket.recvfrom_timeout(buf, size, key, &timeout);
}
int NetModSocket::recvfrom_nowait(void **buf, int *size, int *port){
  return shmModSocket.recvfrom_nowait(buf, size, port);
int NetModSocket::recvfrom_nowait(void **buf, int *size, int *key){
  return shmModSocket.recvfrom_nowait(buf, size, key);
}
/**
 * 发送请求信息并等待接收应答
 * @port 发送给谁
 * @key 发送给谁
 * @return 0 成功, 其他值 失败的错误码
*/
int NetModSocket::sendandrecv( const void *send_buf, const int send_size, const int port, void **recv_buf, int *recv_size){
  return shmModSocket.sendandrecv(send_buf, send_size, port, recv_buf, recv_size);
int NetModSocket::sendandrecv( const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size){
  return shmModSocket.sendandrecv(send_buf, send_size, key, recv_buf, recv_size);
}
// 超时返回。 @sec 秒 , @nsec 纳秒
int NetModSocket::sendandrecv_timeout( const void *send_buf, const int send_size, const int port, void **recv_buf, int *recv_size, int sec, int nsec){
int NetModSocket::sendandrecv_timeout( const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size, int sec, int nsec){
  struct timespec timeout = {sec, nsec};
  return shmModSocket.sendandrecv_timeout(send_buf, send_size, port, recv_buf, recv_size, &timeout);
  return shmModSocket.sendandrecv_timeout(send_buf, send_size, key, recv_buf, recv_size, &timeout);
}
int NetModSocket::sendandrecv_nowait( const void *send_buf, const int send_size, const int port, void **recv_buf, int *recv_size) {
  return shmModSocket.sendandrecv_nowait(send_buf, send_size, port, recv_buf, recv_size);
int NetModSocket::sendandrecv_nowait( const void *send_buf, const int send_size, const int key, void **recv_buf, int *recv_size) {
  return shmModSocket.sendandrecv_nowait(send_buf, send_size, key, recv_buf, recv_size);
}
@@ -440,18 +440,18 @@
 * 订阅指定主题
 * @topic 主题
 * @size 主题长度
 * @port 总线端口
 * @key 总线端口
 */
int  NetModSocket::sub( void *topic, int size, int port){
  return shmModSocket.sub((char *)topic,  size,  port);
int  NetModSocket::sub( void *topic, int size, int key){
  return shmModSocket.sub((char *)topic,  size,  key);
}
// 超时返回。 @sec 秒 , @nsec 纳秒
int  NetModSocket::sub_timeout( void *topic, int size, int port, int sec, int nsec){
int  NetModSocket::sub_timeout( void *topic, int size, int key, int sec, int nsec){
  struct timespec timeout = {sec, nsec};
  return shmModSocket.sub_timeout((char *)topic,  size,  port, &timeout);
  return shmModSocket.sub_timeout((char *)topic,  size,  key, &timeout);
}
int  NetModSocket::sub_nowait( void *topic, int size, int port){
  return shmModSocket.sub_nowait((char *)topic,  size,  port);
int  NetModSocket::sub_nowait( void *topic, int size, int key){
  return shmModSocket.sub_nowait((char *)topic,  size,  key);
}
@@ -460,18 +460,18 @@
 * 取消订阅指定主题
 * @topic 主题
 * @size 主题长度
 * @port 总线端口
 * @key 总线端口
 */
int  NetModSocket::desub( void *topic, int size, int port){
  return shmModSocket.desub((char *)topic,  size,  port);
int  NetModSocket::desub( void *topic, int size, int key){
  return shmModSocket.desub((char *)topic,  size,  key);
}
// 超时返回。 @sec 秒 , @nsec 纳秒
int  NetModSocket::desub_timeout( void *topic, int size, int port, int sec, int nsec){
int  NetModSocket::desub_timeout( void *topic, int size, int key, int sec, int nsec){
  struct timespec timeout = {sec, nsec};
  return shmModSocket.desub_timeout((char *)topic,  size,  port, &timeout);
  return shmModSocket.desub_timeout((char *)topic,  size,  key, &timeout);
}
int  NetModSocket::desub_nowait( void *topic, int size, int port){
  return shmModSocket.desub_nowait((char *)topic,  size,  port);
int  NetModSocket::desub_nowait( void *topic, int size, int key){
  return shmModSocket.desub_nowait((char *)topic,  size,  key);
}
@@ -480,18 +480,18 @@
 * 发布主题
 * @topic 主题
 * @content 主题内容
 * @port 总线端口
 * @key 总线端口
 */
int  NetModSocket::pub( char *topic, int topic_size, void *content, int content_size, int port){
  return shmModSocket.pub(topic, topic_size, content, content_size, port);
int  NetModSocket::pub( char *topic, int topic_size, void *content, int content_size, int key){
  return shmModSocket.pub(topic, topic_size, content, content_size, key);
}
//  超时返回。 @sec 秒 , @nsec 纳秒
int  NetModSocket::pub_timeout( char *topic, int topic_size, void *content, int content_size, int port, int sec, int nsec){
int  NetModSocket::pub_timeout( char *topic, int topic_size, void *content, int content_size, int key, int sec, int nsec){
  struct timespec timeout = {sec, nsec};
  return shmModSocket.pub_timeout(topic, topic_size, content, content_size, port, &timeout);
  return shmModSocket.pub_timeout(topic, topic_size, content, content_size, key, &timeout);
}
int  NetModSocket::pub_nowait( char *topic, int topic_size, void *content, int content_size, int port){
  return shmModSocket.pub_nowait(topic, topic_size, content, content_size, port);
int  NetModSocket::pub_nowait( char *topic, int topic_size, void *content, int content_size, int key){
  return shmModSocket.pub_nowait(topic, topic_size, content, content_size, key);
}
src/socket/net_mod_socket.h
@@ -100,13 +100,13 @@
   * 绑定端口到socket, 如果不绑定则系统自动分配一个
   * @return 0 成功, 其他值 失败的错误码
  */
  int bind( int port);
  int bind( int key);
  /**
   * 强制绑定端口到socket, 适用于程序非正常关闭的情况下,重启程序绑定原来还没释放的key
   * @return 0 成功, 其他值 失败的错误码
  */
  int force_bind( int port);
  int force_bind( int key);
  /**
   * 如果建立连接的节点没有接受到消息会一直等待
@@ -150,34 +150,34 @@
  /**
   * 发送信息
   * @port 发送给谁
   * @key 发送给谁
   * @return 0 成功, 其他值 失败的错误码
   */
  int sendto( const void *buf, const int size, const int port);
  int sendto( const void *buf, const int size, const int key);
  // 发送信息超时返回。 @sec 秒 , @nsec 纳秒
  int sendto_timeout( const void *buf, const int size, const int port, int sec, int nsec);
  int sendto_timeout( const void *buf, const int size, const int key, int sec, int nsec);
  // 发送信息立刻返回。
  int sendto_nowait( const void *buf, const int size, const int port);
  int sendto_nowait( const void *buf, const int size, const int key);
  /**
   * 接收信息
   * @port 从谁哪里收到的信息
   * @key 从谁哪里收到的信息
   * @return 0 成功, 其他值 失败的错误码
  */
  int recvfrom( void **buf, int *size, int *port);
  int recvfrom( void **buf, int *size, int *key);
  // 接受信息超时返回。 @sec 秒 , @nsec 纳秒
  int recvfrom_timeout( void **buf, int *size, int *port, int sec, int nsec);
  int recvfrom_nowait( void **buf, int *size, int *port);
  int recvfrom_timeout( void **buf, int *size, int *key, int sec, int nsec);
  int recvfrom_nowait( void **buf, int *size, int *key);
  /**
   * 本地发送请求信息并等待接收应答
   * @port 发送给谁
   * @key 发送给谁
   * @return 0 成功, 其他值 失败的错误码
  */
  int sendandrecv( const void *send_buf, const int send_size, const int send_port, void **recv_buf, int *recv_size) ;
  int sendandrecv( const void *send_buf, const int send_size, const int send_key, void **recv_buf, int *recv_size) ;
  // 超时返回。 @sec 秒 , @nsec 纳秒
  int sendandrecv_timeout( const void *send_buf, const int send_size, const int send_port, void **recv_buf, int *recv_size, int sec, int nsec) ;
  int sendandrecv_nowait( const void *send_buf, const int send_size, const int send_port, void **recv_buf, int *recv_size) ;
  int sendandrecv_timeout( const void *send_buf, const int send_size, const int send_key, void **recv_buf, int *recv_size, int sec, int nsec) ;
  int sendandrecv_nowait( const void *send_buf, const int send_size, const int send_key, void **recv_buf, int *recv_size) ;
  /**
@@ -191,35 +191,35 @@
   * 订阅指定主题
   * @topic 主题
   * @size 主题长度
   * @port 总线端口
   * @key 总线端口
   */
  int  sub( void *topic, int size, int port);
  int  sub( void *topic, int size, int key);
  // 超时返回。 @sec 秒 , @nsec 纳秒
  int  sub_timeout( void *topic, int size, int port, int sec, int nsec);
  int  sub_nowait( void *topic, int size, int port);
  int  sub_timeout( void *topic, int size, int key, int sec, int nsec);
  int  sub_nowait( void *topic, int size, int key);
  /**
   * 取消订阅指定主题
   * @topic 主题,主题为空时取消全部订阅
   * @size 主题长度
   * @port 总线端口
   * @key 总线端口
   */
  int  desub( void *topic, int size, int port);
  int  desub( void *topic, int size, int key);
  // 超时返回。 @sec 秒 , @nsec 纳秒
  int  desub_timeout( void *topic, int size, int port, int sec, int nsec);
  int  desub_nowait( void *topic, int size, int port);
  int  desub_timeout( void *topic, int size, int key, int sec, int nsec);
  int  desub_nowait( void *topic, int size, int key);
  /**
   * 发布主题
   * @topic 主题
   * @content 主题内容
   * @port 总线端口
   * @key 总线端口
   */
  int  pub( char *topic, int topic_size, void *content, int content_size, int port);
  int  pub( char *topic, int topic_size, void *content, int content_size, int key);
  //  超时返回。 @sec 秒 , @nsec 纳秒
  int  pub_timeout( char *topic, int topic_size, void *content, int content_size, int port, int sec, int nsec);
  int  pub_nowait( char *topic, int topic_size, void *content, int content_size, int port);
  int  pub_timeout( char *topic, int topic_size, void *content, int content_size, int key, int sec, int nsec);
  int  pub_nowait( char *topic, int topic_size, void *content, int content_size, int key);
src/socket/net_mod_socket_wrapper.h
@@ -28,34 +28,34 @@
 * 绑定端口到socket, 如果不绑定则系统自动分配一个
 * @return 0 成功, 其他值 失败的错误码
*/
int net_mod_socket_bind(void * _socket, int port);
int net_mod_socket_bind(void * _socket, int key);
/**
 * 强制绑定端口到socket, 适用于程序非正常关闭的情况下,重启程序绑定原来还没释放的key
 * @return 0 成功, 其他值 失败的错误码
*/
int net_mod_socket_force_bind(void * _socket, int port);
int net_mod_socket_force_bind(void * _socket, int key);
/**
 * 发送信息
 * @port 发送给谁
 * @key 发送给谁
 * @return 0 成功, 其他值 失败的错误码
 */
int net_mod_socket_sendto(void *_socket, const void *buf, const int size, const int port);
int net_mod_socket_sendto(void *_socket, const void *buf, const int size, const int key);
// 发送信息超时返回。 @sec 秒 , @nsec 纳秒
int net_mod_socket_sendto_timeout(void *_socket, const void *buf, const int size, const int port, int sec, int nsec);
int net_mod_socket_sendto_timeout(void *_socket, const void *buf, const int size, const int key, int sec, int nsec);
// 发送信息立刻返回。
int net_mod_socket_sendto_nowait(void *_socket, const void *buf, const int size, const int port);
int net_mod_socket_sendto_nowait(void *_socket, const void *buf, const int size, const int key);
/**
 * 接收信息
 * @port 从谁哪里收到的信息
 * @key 从谁哪里收到的信息
 * @return 0 成功, 其他值 失败的错误码
*/
int net_mod_socket_recvfrom(void *_socket, void **buf, int *size, int *port);
int net_mod_socket_recvfrom(void *_socket, void **buf, int *size, int *key);
// 接受信息超时返回。 @sec 秒 , @nsec 纳秒
int net_mod_socket_recvfrom_timeout(void *_socket, void **buf, int *size, int *port, int sec, int nsec);
int net_mod_socket_recvfrom_nowait(void *_socket, void **buf, int *size, int *port);
int net_mod_socket_recvfrom_timeout(void *_socket, void **buf, int *size, int *key, int sec, int nsec);
int net_mod_socket_recvfrom_nowait(void *_socket, void **buf, int *size, int *key);
  
@@ -108,24 +108,24 @@
 * 订阅指定主题
 * @topic 主题
 * @size 主题长度
 * @port 总线端口
 * @key 总线端口
 */
int  net_mod_socket_sub(void * _socket, void *topic, int size, int port);
int  net_mod_socket_sub(void * _socket, void *topic, int size, int key);
// 超时返回。 @sec 秒 , @nsec 纳秒
int  net_mod_socket_sub_timeout(void * _socket, void *topic, int size, int port, int sec, int nsec);
int  net_mod_socket_sub_nowait(void * _socket, void *topic, int size, int port);
int  net_mod_socket_sub_timeout(void * _socket, void *topic, int size, int key, int sec, int nsec);
int  net_mod_socket_sub_nowait(void * _socket, void *topic, int size, int key);
/**
 * 取消订阅指定主题
 * @topic 主题,主题为空时取消全部订阅
 * @size 主题长度
 * @port 总线端口
 * @key 总线端口
 */
int  net_mod_socket_desub(void * _socket, void *topic, int size, int key);
// 超时返回。 @sec 秒 , @nsec 纳秒
int  net_mod_socket_desub_timeout(void * _socket, void *topic, int size, int port, int sec, int nsec);
int  net_mod_socket_desub_nowait(void * _socket, void *topic, int size, int port);
int  net_mod_socket_desub_timeout(void * _socket, void *topic, int size, int key, int sec, int nsec);
int  net_mod_socket_desub_nowait(void * _socket, void *topic, int size, int key);
/**