Net docs, 2nd round
* add doc for net methods - net.socket:getpeer() - net.server:on() - net.server:send() * document net.multicast[Join|Leave]()
This commit is contained in:
parent
f3cc39c2a2
commit
a1ffe2e9fd
|
@ -53,6 +53,34 @@ net.createServer(net.TCP, 30) -- 30s timeout
|
||||||
#### See also
|
#### See also
|
||||||
[`net.createConnection()`](#netcreateconnection)
|
[`net.createConnection()`](#netcreateconnection)
|
||||||
|
|
||||||
|
## net.multicastJoin()
|
||||||
|
|
||||||
|
Join multicast group.
|
||||||
|
|
||||||
|
#### Syntax
|
||||||
|
`net.multicastJoin(if_ip, multicast_ip)`
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
- `if_ip` string containing the interface ip to join the multicast group. "any" or "" affects all interfaces.
|
||||||
|
- `multicast_ip` of the group to join
|
||||||
|
|
||||||
|
#### Returns
|
||||||
|
`nil`
|
||||||
|
|
||||||
|
## net.multicastLeave()
|
||||||
|
|
||||||
|
Leave multicast group.
|
||||||
|
|
||||||
|
#### Syntax
|
||||||
|
`net.multicastLeave(if_ip, multicast_ip)`
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
- `if_ip` string containing the interface ip to leave the multicast group. "any" or "" affects all interfaces.
|
||||||
|
- `multicast_ip` of the group to leave
|
||||||
|
|
||||||
|
#### Returns
|
||||||
|
`nil`
|
||||||
|
|
||||||
# net.server Module
|
# net.server Module
|
||||||
|
|
||||||
## net.server:close()
|
## net.server:close()
|
||||||
|
@ -110,6 +138,20 @@ end)
|
||||||
#### See also
|
#### See also
|
||||||
[`net.createServer()`](#netcreateserver)
|
[`net.createServer()`](#netcreateserver)
|
||||||
|
|
||||||
|
## net.server:on()
|
||||||
|
|
||||||
|
UDP server only: Register callback functions for specific events.
|
||||||
|
|
||||||
|
#### See also
|
||||||
|
[`net.socket:on()`](#netsocketon)
|
||||||
|
|
||||||
|
## net.server:send()
|
||||||
|
|
||||||
|
UDP server only: Sends data to remote peer.
|
||||||
|
|
||||||
|
#### See also
|
||||||
|
[`net.socket:send()`](#netsocketsend)
|
||||||
|
|
||||||
# net.socket Module
|
# net.socket Module
|
||||||
## net.socket:close()
|
## net.socket:close()
|
||||||
|
|
||||||
|
@ -168,6 +210,20 @@ sk = nil
|
||||||
#### See also
|
#### See also
|
||||||
[`net.createServer()`](#netcreateserver)
|
[`net.createServer()`](#netcreateserver)
|
||||||
|
|
||||||
|
## net.socket:getpeer()
|
||||||
|
|
||||||
|
Retrieve port and ip of peer.
|
||||||
|
|
||||||
|
#### Syntax
|
||||||
|
`getpeer()`
|
||||||
|
|
||||||
|
#### Parameters
|
||||||
|
none
|
||||||
|
|
||||||
|
#### Returns
|
||||||
|
- `ip` of peer
|
||||||
|
- `port` of peer
|
||||||
|
|
||||||
## net.socket:hold()
|
## net.socket:hold()
|
||||||
|
|
||||||
Throttle data reception by placing a request to block the TCP receive function. This request is not effective immediately, Espressif recommends to call it while reserving 5*1460 bytes of memory.
|
Throttle data reception by placing a request to block the TCP receive function. This request is not effective immediately, Espressif recommends to call it while reserving 5*1460 bytes of memory.
|
||||||
|
@ -215,7 +271,7 @@ end)
|
||||||
|
|
||||||
## net.socket:send()
|
## net.socket:send()
|
||||||
|
|
||||||
Sends data to server.
|
Sends data to remote peer.
|
||||||
|
|
||||||
#### Syntax
|
#### Syntax
|
||||||
`send(string[, function(sent)])`
|
`send(string[, function(sent)])`
|
||||||
|
@ -282,7 +338,7 @@ end)
|
||||||
|
|
||||||
## net.socket:unhold()
|
## net.socket:unhold()
|
||||||
|
|
||||||
Unblock TCP receiving data, i.e. undo `hold()`.
|
Unblock TCP receiving data by revocation of a preceding `hold()`.
|
||||||
|
|
||||||
#### Syntax
|
#### Syntax
|
||||||
`unhold()`
|
`unhold()`
|
||||||
|
|
Loading…
Reference in New Issue