xlang v4.0 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
StreamSocket.xcs
浏览该文件的文档.
1
5@Declare
6class StreamSocket : Stream{
11
12
19 bool bind(String host, int port);
20
28 int read(byte [] buffer, int pos, int length);
29
37 int write(byte [] buffer, int pos, int length);
38
42 void close();
43
44
50 long available(bool wait);
51
52
57 int getHandle();
58
65 bool connect(String host, int port);
66
73 bool listen(int port, int backlog);
74
75
80 StreamSoket accept();
81
87
88
94 bool setTimeout(int millis);
95
101 bool enableNagle(bool be);
102
108 bool enableKeepAlive(bool be);
109
114 void setSelectFlags(int flags);
115
121
130 int select(StreamSocket [] sockets, int offset, int count, int[] sets, int timeout);
131
137
143
149
150
156
157
163
169
175
181};
网络地址类
流接口
tcp协议套接字
long length()
InetAddress getLocalInetAddress()
获取本地地址信息
int getHandle()
获取套接字句柄
bool isNagleEnabled()
检查是否开启nagle算法
int getLocalAddress()
获取本地32位的IP地址信息
void close()
关闭套接字
int getRemoteAddress()
获取远程32位的IP地址信息
bool isConnected()
是否已连接
int write(byte [] buffer, int pos, int length)
写入数据
int getLocalPort()
获取本地端口信息
StreamSoket accept()
接受连接
bool enableNagle(bool be)
开启禁用nagle算法
long available(bool wait)
是否可读
void setSelectFlags(int flags)
设置select触发的选项
int getSelectFlags()
获取select触发的选项
bool setTimeout(int millis)
设置超时
InetAddress getRemoteInetAddress()
获取远程地址信息
bool bind(String host, int port)
bind地址
bool isKeepAliveEnabled()
检查是否开启长连接
int select(StreamSocket [] sockets, int offset, int count, int[] sets, int timeout)
选择事件触发的socket
bool enableKeepAlive(bool be)
开启禁用长连接
bool connect(String host, int port)
建立UDP连接
int read(byte [] buffer, int pos, int length)
读取数据
int getRemotePort()
获取远程端口信息
void StreamSocket()
构造函数
bool listen(int port, int backlog)
监听端口
字符串类