sipb_sendrecv_tcp.h

来自「sip torture test tools」· C头文件 代码 · 共 44 行

H
44
字号
//sipb_sendrecv_tcp.h//Copyright (C) 2003 Metalink LTD//Author: Rodionov Sergey (seger@metalinkltd.com)//This program is distributed under terms of GPL (see LICENSE)#ifndef __SEGER__MLTD_SIPB_SENDRECV_TCP_H__#define __SEGER__MLTD_SIPB_SENDRECV_TCP_H__#include <sys/socket.h>#include <netinet/in.h>#include <unistd.h>#include <string>using namespace std;class sipb_sendrecv_tcp{ public:   sipb_sendrecv_tcp();   ~sipb_sendrecv_tcp(){close(soc);};   int get_port();   void rebind();  //get next random port (after this function you must                    //run connect or laccept)   bool make_connect(in_addr addr,int port);  //if return ECONNREFUSED                                              //return false    bool laccept(in_addr&ip,int& port,		int ms_timeout); //listen and accept  (from any address)                                 //ms_timeout in ms   bool sendtcp(const string&);   bool recvtcp_add(string& to_recv,int ms_timeout); //if timeout return false      bool is_connect(){return _is_connect;};      //it's usefull run this function (may be hungup)   bool check_hungup();  //if some error set _is_connect=false and return                         //false private:   int soc;   bool _is_connect; private:   int recvbuf_size();   };#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?