mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-08-03 02:56:53 -04:00
Created Component/Internet (markdown)
parent
f5a95e387b
commit
5b9f6dbf9d
17
Component-Internet.md
Normal file
17
Component-Internet.md
Normal file
@ -0,0 +1,17 @@
|
||||
This lists the callbacks made available by the Internet Card. Also see the [[Internet API|API/Internet]] for more comfortable access to the HTTP and TCP functionality.
|
||||
|
||||
- `internet.isHttpEnabled():boolean`
|
||||
Returns whether HTTP requests are allowed on the server (config setting).
|
||||
- `internet.isTcpEnabled():boolean`
|
||||
Returns whether TCP sockets are allowed on the server (config setting).
|
||||
- `internet.request(url:string[, postData:string]):boolean`
|
||||
Begins an HTTP request to the specified URL with the specified POST data (if any). Responses will be enqueued as `http_response` signals. Consider using the iterator wrapper in the Internet API instead.
|
||||
- `internet.connect(address:string[, port:number]):number`
|
||||
Opens a new TCP connection. Returns the handle of the connection. The returned handle can be used to interact with the opened socket using the other callbacks. This can error if TCP sockets are not enabled, there are too many open connections or some other I/O error occurs.
|
||||
Consider using the Internet API to get a buffered stream wrapping the opened socket handle (`internet.open`).
|
||||
- `internet.read(handle:number, n:number):string`
|
||||
Tries to read data from the socket stream. Returns the read byte array. Takes the handle returned from `internet.connect`.
|
||||
- `internet.write(handle:number, data:string): number`
|
||||
Tries to write data to the socket stream. Returns the number of bytes written. Takes the handle returned by `internet.connect`.
|
||||
- `internet.close(handle:number)`
|
||||
Closes the socket with the specified handle (obtained from `internet.connect`).
|
Loading…
x
Reference in New Issue
Block a user