代码拉取完成,页面将自动刷新
// netlib.hpp
#ifndef _KS_INC_NETLIB_HPP_
#define _KS_INC_NETLIB_HPP_
#include "netlib.h"
namespace ks {
bool net_address_make(struct sockaddr* addr, const char* ip, unsigned short port)
{ return ks_net_address_make(addr, ip, port)!=FALSE; }
bool net_address_make(struct sockaddr* addr, const char* ip_port)
{ return ks_net_address_make1(addr, ip_port)!=FALSE; }
class NetChannel {
public:
static NetChannel* cast(KSNetChannel* channel) { return (NetChannel*)channel; }
operator KSNetChannel* () { return &channel_; }
public:
KSNetChannelStatus status() const { return channel_.status; }
int err() const { return channel_.err; }
int fd() const { return channel_.fd; }
bool working() const { return ks_net_channel_is_working(&channel_); }
public:
bool connect_sync(KSNetEventDispatcher* dp, const struct sockaddr* addr)
{ return ks_net_channel_connect_sync(&channel_, dp, addr)!=FALSE; }
bool connect_async(KSNetEventDispatcher* dp, const struct sockaddr* addr)
{ return ks_net_channel_connect_async(&channel_, dp, addr)!=FALSE; }
bool connect_finish(KSNetEventDispatcher* dp, int fd)
{ return ks_net_channel_connect_finish(&channel_, fd)!=FALSE; }
bool write_all(const void* buf, size_t len, const void* header_buf=0, size_t header_len=0)
{ return ks_net_channel_write_all_full(&channel_, buf, len, header_buf, header_len)!=FALSE; }
size_t write(const void* buf, size_t len)
{ return ks_net_channel_write(&channel_, buf, len); }
void flush()
{ ks_net_channel_flush(&channel_); }
void close(int status=KS_NET_CHANNEL_ST_CLOSED, int err=0)
{ ks_net_channel_close_full(&channel_, status, err); }
void close_wait_peer()
{ ks_net_channel_close_wait_peer(&channel_); }
private:
KSNetChannel channel_;
};
} // ks
#endif//_KS_INC_NETLIB_HPP_
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。