Contents

listener(_:shouldAcceptNewConnection:from:)

Returns a Boolean value that indicates whether to accept a new connection from the guest operating system.

Declaration

optional func listener(_ listener: VZVirtioSocketListener, shouldAcceptNewConnection connection: VZVirtioSocketConnection, from socketDevice: VZVirtioSocketDevice) -> Bool

Parameters

  • listener:

    The listener object that monitors the associated port.

  • connection:

    The object that contains information about the proposed connection. Use this object to fetch port information.

  • socketDevice:

    The Virtio socket device that requested the connection.

Return Value

true to establish the connection, or false to reject it.

Discussion

Use your method’s implementation to quickly determine whether to accept or reject connection attempts. A typical implementation verifies that a connection between the specified ports is permissible. Return a result as quickly as possible, and don’t perform any long-running operations in this method.

If you don’t implement this method, the virtual machine refuses all connection requests as if this method returned false.