'(Private) Generates the text of a given PORT command.'

def generatePortCommand(self, portCmd):

    factory = FTPDataPortFactory()
    factory.protocol = portCmd.protocol
    listener = reactor.listenTCP(0, factory)
    factory.port = listener
    def listenerFail(error, listener=listener):
        if listener.connected:
            listener.loseConnection()
        return error
    portCmd.fail = listenerFail
    host = self.transport.getHost().host
    port = listener.getHost().port
    portCmd.text = ('PORT    ' + encodeHostPort(host, port))
