📄 socket.h
字号:
// This file needs -*- c++ -*- mode
// ============================================================================
// Socket public interface
//
// (c) 2003 Ken Reed
//
// This is free software. You can redistribute it and/or modify it under the
// terms of the GNU General Public License version 2 as published by the Free
// Software Foundation.
// ============================================================================
#pragma once
#include <iostream>
#include <string>
#include "exception.h"
class Buffer;
class Sock_exception : public Exception
{
public:
Sock_exception(const std::string & message);
};
class Socket : public std::iostream {
public:
Socket(int port = -1);
~Socket();
int bytes_read (bool reset_count = false);
int bytes_sent (bool reset_count = false);
int get_number ();
void close ();
void connect (const char * const host, const int port);
void getline (std::string & s);
void listen ();
void read_binary (void * buffer, int buffer_size);
void write_binary (void * buffer, int buffer_size);
void set_connection (void * handle);
void set_trace (const char * filename);
void * get_connection ();
protected:
Buffer * rdbuf();
private:
Socket (const Socket & Socket); // No copying allowed
void bind (const int port);
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -