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

📄 clientsocket.cpp

📁 在linux使用c++开发的socke程序
💻 CPP
字号:
// Implementation of the ClientSocket class#include "ClientSocket.h"#include "SocketException.h"ClientSocket::ClientSocket ( std::string host, int port ){  if ( ! Socket::create() )    {      throw SocketException ( "Could not create client socket." );    }  if ( ! Socket::connect ( host, port ) )    {      throw SocketException ( "Could not bind to port." );    }}const ClientSocket& ClientSocket::operator << ( const std::string& s ) const{  if ( ! Socket::send ( s ) )    {      throw SocketException ( "Could not write to socket." );    }  return *this;}const ClientSocket& ClientSocket::operator >> ( std::string& s ) const{  if ( ! Socket::recv ( s ) )    {      throw SocketException ( "Could not read from socket." );    }  return *this;}

⌨️ 快捷键说明

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