This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
component:internet:zh [2023/11/05 10:41] hfsr [TCP Socket Object] |
component:internet:zh [2023/11/05 10:47] hfsr [TCP Socket Object] |
||
---|---|---|---|
Line 8: | Line 8: | ||
- `isTcpEnabled():boolean` | - `isTcpEnabled():boolean` | ||
- | 返回是否可建立TCP连接(可在配置文件中设置)。 | + | 返回是否可建立TCP连接(可在配置文件中设置)。 |
- | \\ | + | |
- `isHttpEnabled():boolean` | - `isHttpEnabled():boolean` | ||
- | 返回是否可进行HTTP请求(可在配置文件中设置)。 | + | 返回是否可进行HTTP请求(可在配置文件中设置)。 |
- | \\ | + | |
- `connect(address:string[, port:number]):userdata` | - `connect(address:string[, port:number]):userdata` | ||
- | 建立一个新的TCP连接。返回连接的句柄。 | + | 建立一个新的TCP连接。返回连接的句柄。 |
- | \\ | + | |
- `request(url:string[, postData:string[, headers:table]]):userdata` | - `request(url:string[, postData:string[, headers:table]]):userdata` | ||
- | 发送一个新的HTTP请求。返回连接的句柄。 | + | 发送一个新的HTTP请求。返回连接的句柄。 |
- | | + | |
====TCP套接字对象==== | ====TCP套接字对象==== | ||
Line 34: | Line 30: | ||
After calling `finishConnect` or `read`, this socket generates a signal named `internet_ready` whenever new data is available to be read. It has one parameter which is the socket id. | After calling `finishConnect` or `read`, this socket generates a signal named `internet_ready` whenever new data is available to be read. It has one parameter which is the socket id. | ||
- | ==== HTTP Request Object ==== | + | ====HTTP请求对象==== |
- `read([n:number]):string` | - `read([n:number]):string` |