B4J Programming Press on the image to return to the main documentation page.

rESP8266WiFi

List of types:

ESP8266WiFi
WiFiServerSocket
WiFiSocket
WiFiSSLSocket
WiFiUDP

ESP8266WiFi


Events:

None

Members:


  AccessPointIp As String [read only]

  Connect (SSID As String) As Boolean

  Connect2 (SSID As String, Password As String) As Boolean

  Disconnect As void

  IsConnected As Boolean [read only]

  LocalIp As String [read only]

  Scan As Byte

  ScannedRSSI (Index As Byte) As Long

  ScannedSSID (Index As Byte) As String

  StartAccessPoint (SSID As String) As Boolean

  StartAccessPoint2 (SSID As String, Password As String) As Boolean

Members description:

AccessPointIp As String [read only]
Returns the board ip when the board acts as an access point.
Connect (SSID As String) As Boolean
Tries to connect to the open network. Return True if successful.
Connect2 (SSID As String, Password As String) As Boolean
Tries to connect to the secured network. Returns True if successful.
Disconnect As void
IsConnected As Boolean [read only]
Returns true if WiFi is connected.
LocalIp As String [read only]
Returns the local ip address as a string.
Scan As Byte
Scans for wireless networks. Returns the number of networks found.
ScannedRSSI (Index As Byte) As Long
Returns the RSSI of the network. Make sure to call Scan before calling this method.
Index - The index of the network in the internal list.
ScannedSSID (Index As Byte) As String
Returns the SSID of the network. Make sure to call Scan before calling this method.
Index - The index of the network in the internal list.
StartAccessPoint (SSID As String) As Boolean
Starts the soft access point.
SSID - The network name.
StartAccessPoint2 (SSID As String, Password As String) As Boolean
Starts the soft access point.
SSID - The network name.
Password - Network password.

WiFiServerSocket

A server socket implementation. Usage is identical to the usage of EthernetServerSocket.

Events:

NewConnection (NewSocket As WiFiSocket)

Members:


  Initialize (Port As UInt, NewConnectionSub As SubVoidWiFiSocket) As void

  Listen As void

  Socket As WiFiSocket [read only]

Members description:

Initialize (Port As UInt, NewConnectionSub As SubVoidWiFiSocket) As void
Initializes the server.
Port - The server port.
NewConnectionSub - The sub that will handle the NewConnection event.
Listen As void
Starts listening for connections.
The NewConnection event will be raised when a client connects.
You should call Listen again after the connection has broken. AsyncStreams_Error is a good place for this call.
Socket As WiFiSocket [read only]
Returns the last connected socket.

WiFiSocket

A client socket implementation. Usage is identical to the usage of EthernetSocket.

Events:

None

Members:


  Close As void

  Connected As Boolean [read only]

  ConnectHost (Host As String, Port As UInt) As Boolean

  ConnectIP (IP() As Byte, Port As UInt) As Boolean

  Stream As B4RStream [read only]

Members description:

Close As void
Closes the connection.
Connected As Boolean [read only]
Tests whether the client is connected.
ConnectHost (Host As String, Port As UInt) As Boolean
Tries to connect to the server. Returns true if connection was successful.
Host - Host name.
Port - Server port.
ConnectIP (IP() As Byte, Port As UInt) As Boolean
Tries to connect to the server. Returns true if connection was successful.
IP - Server ip address as an array of bytes.
Port - Server port.
Stream As B4RStream [read only]
Gets the network stream. Can be used together with AsyncStreams.

WiFiSSLSocket

A client SSL socket implementation. Similar to WiFiSocket. Can only make SSL connections.
Note that the server certificate is not verified unless you explicitly verify it with the VerifyCertificate method.

Events:

None

Members:


  Close As void

  Connected As Boolean [read only]

  ConnectHost (Host As String, Port As UInt) As Boolean

  ConnectIP (IP() As Byte, Port As UInt) As Boolean

  Stream As B4RStream [read only]

  VerifyCertificate (FingerPrint As String, Host As String) As Boolean

Members description:

Close As void
Closes the connection.
Connected As Boolean [read only]
Tests whether the client is connected.
ConnectHost (Host As String, Port As UInt) As Boolean
Tries to connect to the server. Returns true if connection was successful.
Host - Host name.
Port - Server port.
ConnectIP (IP() As Byte, Port As UInt) As Boolean
Tries to connect to the server. Returns true if connection was successful.
IP - Server ip address as an array of bytes.
Port - Server port.
Stream As B4RStream [read only]
Gets the network stream. Can be used together with AsyncStreams.
VerifyCertificate (FingerPrint As String, Host As String) As Boolean

WiFiUDP

Allows receiving and sending UDP packets. Usage is identical to the usage of EthernetUDP.

Events:

PacketArrived (Data() As Byte, IP() As Byte, Port As UInt)

Members:


  BeginPacket (IP() As Byte, Port As UInt) As Boolean

  Close As void

  Initialize (Port As UInt, PacketArrivedSub As SubPacketArrived) As Boolean

  SendPacket As Boolean

  Write (Data() As Byte) As Int

Members description:

BeginPacket (IP() As Byte, Port As UInt) As Boolean
Starts sending a packet. The packet will be sent when SendPacket is called.
IP - Target ip address.
Port - Target port address.
Close As void
Closes the socket.
Initialize (Port As UInt, PacketArrivedSub As SubPacketArrived) As Boolean
Initializes the object. Returns True if successful.
Port - The UDP socket will be bound to this port.
PacketArrivedSub - The sub that handles the PacketArrived event.
SendPacket As Boolean
Sends the packet.
Write (Data() As Byte) As Int
Writes data to the packet. Returns the number of bytes that were written successfully.
This method should only be called between a call to BeginPacket and SendPacket.
You can call Write multiple times.
Top