xlang v5.1 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
DatagramSocket.x
浏览该文件的文档.
1
6
7 // 定义套接字状态标志常量
8 public static const int FLAGS_READABLE; // 可读状态标志
9 public static const int FLAGS_WRITEABLE; // 可写状态标志
10 public static const int FLAGS_EXCEPTION; // 异常状态标志
11 // 构造函数,创建新的数据报套接字
13 // 绑定套接字到指定地址和端口
14 public bool bind(String, int);
15 // 从套接字读取数据到字节数组
16 public int read(byte[], int, int)
18 // 向套接字写入数据
19 public int write(byte[], int, int)
21 // 关闭套接字
22 public void close();
23 // 获取可用数据长度(布尔参数版本)
24 public long available(bool);
25 // 获取可用数据长度(长整型和整型参数版本)
26 public int available(long, int);
27 // 获取套接字句柄
28 public long getHandle();
29 // 连接到指定地址和端口
30 public bool connect(String, int)
32 // 获取远程网络地址对象(确保返回非空指针)
33 public @NotNilptr InetAddress getRemoteInetAddress();
34 // 获取本地网络地址对象(确保返回非空指针)
35 public @NotNilptr InetAddress getLocalInetAddress();
36 // 获取远程IP地址字符串(确保返回非空指针)
37 public @NotNilptr String getRemoteIpAddress();
38 // 获取远程端口号
39 public int getRemotePort();
40 // 获取本地IP地址字符串(确保返回非空指针)
41 public @NotNilptr String getLocalIpAddress();
42 // 获取本地端口号
43 public int getLocalPort();
44 // 发送数据到指定地址和端口(字符串地址版本)
45 public int sendTo(String, int, byte[], int, int)
47 // 发送数据到指定地址和端口(InetAddress对象版本)
48 public int sendTo(InetAddress, byte[], int, int)
50 // 设置套接字超时时间
51 public bool setSoTimeout(int);
52 // 接收数据报包
53 public bool receive(DatagramPacket);
54 // 设置地址复用
55 public void setReuseAddress(bool);
56 // 获取地址复用设置
57 public bool getReuseAddress();
58 // 设置广播模式
59 public void setBroadcast(bool);
60 // 发送数据报包
61 public bool send(DatagramPacket);
62 // 设置混杂模式
63 public bool setPromiscuousMode(bool);
64 // 检查是否正在监听
65 public bool isListenning();
66 // 获取保持连接状态
67 public bool getKeepAlive();
68 // 设置保持连接状态
69 public bool setKeepAlive(bool);
70 // 获取接收缓冲区大小
71 public int getRecvBufferSize();
72 // 设置接收缓冲区大小
73 public bool setRecvBufferSize(int);
74 // 获取发送缓冲区大小
75 public int getSendBufferSize();
76 // 设置发送缓冲区大小
77 public bool setSendBufferSize(int);
78 // 析构函数
79 public void finalize();
80 // 静态方法,选择可用的套接字
81 public static final int select(DatagramSocket[], int, int, int, int[], int)
83};
static const int FLAGS_WRITEABLE
void setBroadcast(bool)
long available(bool)
String getRemoteIpAddress()
bool setRecvBufferSize(int)
int sendTo(String, int, byte[], int, int)
InetAddress getLocalInetAddress()
bool setKeepAlive(bool)
static const int FLAGS_EXCEPTION
String getLocalIpAddress()
int getRecvBufferSize()
bool receive(DatagramPacket)
int sendTo(InetAddress, byte[], int, int)
int write(byte[], int, int)
bool setPromiscuousMode(bool)
bool isListenning()
int getLocalPort()
int available(long, int)
bool getKeepAlive()
bool getReuseAddress()
long getHandle()
static final int select(DatagramSocket[], int, int, int, int[], int)
int getSendBufferSize()
bool connect(String, int)
InetAddress getRemoteInetAddress()
int read(byte[], int, int)
void setReuseAddress(bool)
bool bind(String, int)
bool setSoTimeout(int)
int getRemotePort()
static const int FLAGS_READABLE
bool send(DatagramPacket)
bool setSendBufferSize(int)
Definition String.x:5