From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Class (inherits from Object)

Used to securely open and close ports on the Xojo Cloud firewall for when you need to connect to an outside service. As long as an instance to the object exists, the port remains open. If the object goes out of scope, is destroyed (set to Nil), or the app terminates, the firewall port is automatically closed.

IsOpen NetworkInterface
Close Open

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



By default, the firewall on your Xojo Cloud server blocks all connections (other than port 80 and port 443) coming into and going out of the system unless a specific exception has been created. The problem with most firewall exceptions is that they are permanent, and because the are not created by the programmer that needs them, when they are no longer needed the exception is not removed and you end up with a security hole. Xojo Cloud solves this problem by using dynamic firewall port allocation. That is, you only open ports when you need them and they automatically close when you don't need them any more.

These are the values for the FirewallPort.Direction enumeration:

Value Description
Incoming Allow incoming data from the specified port.
Outgoing Allow outgoing data to the specified port.

Sample Code

This code opens firewall port 587:

Var 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