Remote Serial Ports - Network COM Ports/Devices Sharing/Redirecting Software for Windows
Docs

IRemotePortDevice Interface

IRemotePortDevice interface is implemented by the virtual serial device object. You can use properties and methods of this interface to control the device and connect it to remote port.

Declaration

interface IRemotePortDevice {
    // Properties
    readonly ${devicePath}: string;
    readonly ${port}: number;
    ${remoteHost}: string;
    ${remotePort}: number;
    ${connectionTimeout}: number;
    ${connectionAttempts}: number;
    ${login}: string;
    ${password}: string;
    ${domain}: string;
    // Methods
    ${deleteDevice}(): void;
}
public interface IRemotePortDevice
{
    // Properties
    string ${devicePath} { get; }
    uint ${port} { get; }
    string ${remoteHost} { get; set; }
    uint ${remotePort} { get; set; }
    uint ${connectionTimeout} { get; set; }
    uint ${connectionAttempts} { get; set; }
    string ${login} { get; set; }
    string ${password} { set; }
    string ${domain} { get; set; }
    // Methods
    void ${deleteDevice}();
}
struct IRemotePortDevice : IDispatch
{
    // Properties
    _bstr_t ${devicePath};  // get 
    unsigned int ${port};  // get 
    _bstr_t ${remoteHost};  // get set 
    unsigned int ${remotePort};  // get set 
    unsigned int ${connectionTimeout};  // get set 
    unsigned int ${connectionAttempts};  // get set 
    _bstr_t ${login};  // get set 
    _bstr_t ${password};  // set 
    _bstr_t ${domain};  // get set 
    // Methods
    HRESULT ${deleteDevice}();
};

IRemotePortDevice Properties

devicePath

readonly devicePath: string;
string devicePath { get; }
_bstr_t devicePath;  // get 

Device path string. This string may be used to open the handle to the port, as an alternative to traditional COMn string. This property is read-only.

port

readonly port: number;
uint port { get; }
unsigned int port;  // get 

Port number associated with this device. This property is read-only.

remoteHost

remoteHost: string;
string remoteHost { get; set; }
_bstr_t remoteHost;  // get set 

Name or address of a remote host this port is associated with.

remotePort

remotePort: number;
uint remotePort { get; set; }
unsigned int remotePort;  // get set 

Port number on a remote server (specified by remoteHost property) this port is associated with.

connectionTimeout

connectionTimeout: number;
uint connectionTimeout { get; set; }
unsigned int connectionTimeout;  // get set 

Connection timeout, in milliseconds. When the local port is opened by application, an attempt to establish connection is made for a given number of milliseconds before returning error code.

connectionAttempts

connectionAttempts: number;
uint connectionAttempts { get; set; }
unsigned int connectionAttempts;  // get set 

Number of connection attempts before giving up.

login

login: string;
string login { get; set; }
_bstr_t login;  // get set 

User name for authentication on the remote server.

password

password: string;
string password { set; }
_bstr_t password;  // set 

User password for authentication on the remote server. For security reasons, this property is write-only.

domain

domain: string;
string domain { get; set; }
_bstr_t domain;  // get set 

User domain name (optional) for authentication on the remote server.

IRemotePortDevice Methods

deleteDevice

deleteDevice(): void;
void deleteDevice();
HRESULT deleteDevice();

Deletes the associated virtual serial port. After calling this method you can no access any properties on this object. The only allowed operation is releasing interface reference.

Example

The following code snippet illustrates the creation and configuration of a virtual serial port:

// The following function gets the name of the remote server
// and its port number, as well as user credentials,  creates a virtual serial port, connects
// it to the server and returns the port name
function connectPort(remoteHost: string, remotePort: number, login: string, 
        password: string, domain: string) : string {
    var library = (IRemotePortLibrary) new ActiveXObject("hhdclientctl.RemotePortLibrary.1");
    var port = library.createPort();

    port.remoteHost = remoteHost;
    port.remotePort = remotePort;
    port.login = login;
    port.password = password;
    port.domain = domain;

    return port.devicePath;
}