⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcpip.h

📁 C++ TCPIP and UDPIP library of classes
💻 H
字号:
/**C++ tcp/ip and udp/ip library and example programmCopyright (C) 2002  Marcin Caban 'Cabko' and Borys Wisniewski 'Boria'This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, orany later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.http://www.gnu.org/Marcin Cabane-mail: cabko@polsl.gliwice.plphone: +48 501 452 123Borys Wisniewskie-mail: boria@polsl.gliwice.plphone: +48 503 065 996*//**  TCP/IP and UDP/IP connection class.  Class for openning sockets to connect somewhere or to listening for a connections.  \author Marcin Caban  \date   Thu Jan 17 01:41:18 2002*/#if !defined tcpip_exists#define tcpip_existsclass tcpip{ public:/**  Default constructor.  Does nothing special.  \author Marcin Caban  \date   Thu Jan 17 01:41:18 2002*/  tcpip ();/**  Default destructor.  Does nothing special.  \author Marcin Caban  \date   Thu Jan 17 01:41:18 2002*/  ~tcpip (); protected:/**  Opens socket for communicating with TCP %server.  \param  host hostname or IP address of the %server  \param  service port number of the %server  \return network socket descriptor  \author Marcin Caban  \date   Thu Jan 17 01:41:18 2002*/  int connectTCP (char* host, char* service);/**  Opens socket for communicating with UDP %server.  \param  host hostname or IP address of the %server  \param  service port number of the %server  \return network socket descriptor  \author Marcin Caban  \date   Thu Jan 17 01:41:18 2002*/  int connectUDP (char* host, char* service);/**  Opens socket for listening for TCP connections from clients.  \param  service port number for listening  \param  qlen maximal length of requests queue  \return network socket descriptor  \author Marcin Caban  \date   Thu Jan 17 01:41:18 2002*/  int passiveTCP (char* service, int qlen);/**  Opens socket for listening for UDP packages from clients.  \param  service port number of the %server  \return network socket descriptor  \author Marcin Caban  \date   Thu Jan 17 01:41:18 2002*/  int passiveUDP (char* service); private:/**  PortBase.  Every port number in this class is incremented by value of this variable.  \todo   Make availability to change value of this variable, now it is always equal to 0.*/  unsigned short int  portbase;/**  Opens socket for communicating with TCP or UDP %server.  \param  host hostname or IP address of the %server  \param  service port number of the %server  \param  protocol "TCP" or "UDP"  \return network socket descriptor  \author Marcin Caban (based on examples from "Internetworking with TCP/IP" written by Douglas E. Comer and David L. Stevens)  \date   Thu Jan 17 01:41:18 2002*/  int connectsock (char* host, char* service, char* protocol);/**  Opens socket for listening for TCP or UDP clients.  \param  service port number of the %server  \param  protocol "TCP" or "UDP"  \param  qlen maximal length of requests queue (for UDP qlen = 0)  \return network socket descriptor  \author Marcin Caban (based on examples from "Internetworking with TCP/IP" written by Douglas E. Comer and David L. Stevens)  \date   Thu Jan 17 01:41:18 2002*/  int passivesock (char* service, char* protocol, int qlen);};#endif

⌨️ 快捷键说明

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