函数声明
VTCP_EXPORT_API( int ) vtcp_getsockopt (VTCP_SOCKET s,int level,int optname,char* optval,int* optlen);
参数:
VTCP_SOCKET s: vtcp 句柄; int level: SOL_SOCKET; int optname: SVTcpSockOpt; int optval: 输出依照optname字段含义决定,参考SVTcpSockOpt; int optlen: 输出optval字段大小; enum EVTcpSoOpt { VTCP_SO_CONNECT_TIMEO = 1, //连接超时(unsigned long)(毫秒) VTCP_SO_RECV_TIMEO = 2, //接收超时(unsigned long)(毫秒) VTCP_SO_RECVFROM_TIMEO = 3, //接收超时(unsigned long)(毫秒) VTCP_SO_SEND_TIMEO = 4, //发送超时(unsigned long)(毫秒) VTCP_SO_SENDTO_TIMEO = 5, //发送超时(unsigned long)(毫秒) VTCP_SO_LINGER = 6, //逗留时间(SVTcpLinger) VTCP_SO_KEEPALIVE = 7, //保活设置(SVTcpKeepAlive) VTCP_SO_RSVP = 8, //资源预留(SVTcpRSVP)(视频传输) VTCP_SO_STAT_COUNT = 9, //统计信息(SVTcpStatCount) }; struct SVTcpKeepAlive { unsigned long onoff; unsigned long keepalivetime; unsigned long keepaliveinterval; }; struct SVTcpLinger { unsigned short l_onoff; unsigned short l_linger; }; struct SVTcpRSVP { unsigned long rsvp_min; //KB/s unsigned long rsvp_max; //KB/s }; typedef struct SVTcpStatCount //状态统计信息 { int sizeOfStruct; //结构大小 unsigned long version; //版本 unsigned long time; //时间 int64 count_recv_bytes; //接收总字节 int64 count_recv_bytes_cur; //接收总字节(当前速度) int64 count_send_bytes; //发送总字节 int64 count_send_bytes_cur; //发送总字节(当前速度) int64 count_do_send_data_rep; //发出数据流包重复个数 int64 count_do_send_data; //发出数据流包个数 int64 count_do_send_data_ack; //发出数据流包应答个数 int64 count_do_send_sync; //发出同步包个数 int64 count_do_send_sync_ack; //发出同步包应答个数 int64 count_on_recv_data_rep; //收到数据流包重复个数 int64 count_on_recv_data; //收到数据流包个数 int64 count_on_recv_data_ack; //收到数据流包应答个数 int64 count_on_recv_sync; //收到同步包个数 int64 count_on_recv_sync_ack; //收到同步包应答个数 int tcp_rtt; //往返周期 int tcp_r; //发送速率 int tcp_r_rsvp; //资源预留 int count_async_opt; //应用层异步队列个数 int count_pm_r; //内核包接收队列 int count_pm_s; //内核包发送队列 unsigned char grap_r[128]; //包发送状态位图 unsigned char grap_s[128]; //包接收状态位图 }S_VTCP_STAT_COUNT,*PS_VTCP_STAT_COUNT;
返回:
VTCP_ERROR(-1): 表示发生错误,通过vtcp_geterror()函数取得具体错误代码,错误代码参考EVTcpErrorCode所示值。
VTCP_OK(0): 表示成功。
备注:
无