mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-08-03 11:07:23 -04:00
Updated API Internet (markdown)
parent
bacf3ca395
commit
f5a95e387b
@ -14,15 +14,15 @@ This library wraps functionality of Internet cards.
|
||||
- `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.
|
||||
- `internet.read(handle:number,n:number):string`
|
||||
Tries to read data from the socket stream. Returns the read byte array.
|
||||
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.
|
||||
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.
|
||||
|
||||
Note for internet.open, you may also do this:
|
||||
```lua
|
||||
local handle = internet.open(...)
|
||||
local handle = internet.connect(...)
|
||||
data = handle:read(10)
|
||||
handle:write("1234")
|
||||
handle:close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user