FirewallPort.Constructor(Port As Integer, DataDirection As XojoCloud.FirewallPort.Direction)

From Xojo Documentation

FirewallPort.Constructor(Port as Integer, DataDirection as XojoCloud.FirewallPort.Direction)

Use to securely open and close ports in a Xojo Cloud firewall.


Port: The port you wish to connect to (outgoing) or listen on (incoming). If you are creating an incoming connection, remember that you can't listen on a port < 1024 (they are reserved for system services). Ports 54320 through 54329 are reserved for use by Xojo for both incoming and outgoing connections. Use of these ports will result in an OutOfBoundsException.

DataDirection: The direction the initial data will be flowing. If your app will be connecting to an outside service, direction = XojoCloud.FirewallPort.Direction.Outgoing. If your app (or a helper app) will be listening on the port, DataDirection = XojoCloud.FirewallPort.Direction.Incoming.

Sample Code

This code opens firewall port 587:

Dim fwp As New XojoCloud.FirewallPort(587, XojoCloud.FirewallPort.Direction.Outgoing)
fwp.Open() // This call is synchronous.
If fwp.isOpen() Then
// Do what you need to do
fwp.Close() //Optional, but if you will not using the port, we recommend it.
End If