## ActivatePort

Activate a port for use.

USAGE

        ActivatePort ( Port, [ BGCommand ] )

Port: The name of the port that you want to activate. (string)

BGCommand: A background command that you want to launch upon port activation. This command should accomplish something useful, such as monitoring the port for incoming calls. DLG:Setup is usually used for regular ports; GETTY and TrapDoor are other popular choices. (optional) (string)

## DeactivatePort

Remove a port from the list of active ports. The port must be active already.

USAGE

        DeactivatePort ( Port, [ Password ] )

Port: The name of the port that you want to deactivate. (string)

Password:A password to use to lock the port. If the port is not already locked with a password, you may leave this out and DLG will supply a password to use while deactivating. If the port has been previously locked with a password, you must supply the same password to get the port. (optional) (string)

## FreePort

Release the lock on a port. You must have already locked it for this to work.

USAGE

        FreePort ( Port, [ Password ] )

Port: The name of the port that you want to release. (string)

Password: A password used to lock the port. If the port was not locked with a password, you must leave this out. If the port has been previously locked with a password, you must supply the same password to get the port. (optional) (string)

## ImmedLockPort

Lock the specified port immediately. If an immediate lock cannot be achieved, it returns immediately with error code -4.

USAGE

        ImmedLockPort ( Port, [ Password ], [ Reason ], [ Priority ], [ Break ] )

Port: The name of the port that you want to lock. (string)

Password:The password used to lock the port. If you leave it blank, DLG will supply an internal password. (optional) (string)

Reason:While this doesn't affect functionality, giving a reason for the lock is helpful to users online at the time. (string) (optional)

Priority: A value between -127 and 128 inclusive, indicating the priority of your lock. If two or more processes are trying to lock the same port, the one with the highest priority will get the lock. Defaults to 0. (numeric) (optional)

Break: An external command that is used to break (interrupt) your process if another process locks the port with a higher priority. If the port is one that has a high level of contention, you should supply this command --otherwise, the system may lock up waiting for your program to release a port.

## LockPort

Lock the specified port, pending the lock until the port is free.

USAGE

        LockPort ( Port, [ Password ], [ Reason ], [ Priority ], [ Break ] )

This command is functionally identical to ImmedLockPort except that it will not return immediately if a lock cannot be obtained. Instead, it will wait indefinately for the lock to happen. As such, this is a somewhat dangerous function -- be very careful using it.

NOTES This function will dwell until the port is available for lock. Use this function only in places where you know that the port will be freed within a reasonable amount of time. If you are uncertain of this, and if you suspect that your entire BBS will be locked up because of a pending lock, then use ImmedLockPort instead -- that's what it's for.

## TransferPortLock

Changes the status of a locked port.

USAGE

        TransferPortLock ( Port, [ OldPassword ], [ NewPassword ],
                              [ Reason ], [ Priority ], [ Break ] )

Port:The name of the port that you want to lock. (string)

OldPassword:The password used to lock the port previously. If you leave it blank, DLG will supply an internal password. (optional) (string)

NewPassword: The new password to lock the port with. If you leave it blank, DLG will supply an internal password. (optional) (string)

Reason: While this doesn't affect functionality, giving a reason for the lock is helpful to users online at the time. (string) (optional)

Priority: A value between -127 and 128 inclusive, indicating the priority of your lock. If two or more processes are trying to lock the same port, the one with the highest priority will get the lock. Defaults to 0. (numeric) (optional)

Break: An external command that is used to break (interrupt) your process if another process locks the port with a higher priority. If the port is one that has a high level of contention, you should supply this command --otherwise, the system may lock up waiting for your program to release a port.