ConnectionInfo.newConnection

Creates a ConnectionInfo struct representing a client configuration which can be provided to the Client class to create a new connection based on its parameters

struct ConnectionInfo
static
newConnection
(
string hostname
,
ushort port
,
string nickname
,
string username
,
string realname
)

Parameters

hostname string

hostname of the server

port ushort

server port

nickname string

nickname to use

Return Value

ConnectionInfo for this server

Examples

Tests invalid conneciton information

1. Invalid hostnames 2. Invalid usernames

try
{
    newConnection("1.", 21, "deavmi", "thedeavmi", "Tristan Brice Birchwood Kildaire");
    assert(false);
}
catch(BirchwoodException e)
{
    assert(e.getType() == ErrorType.INVALID_CONN_INFO);
}

try
{
    newConnection("1.1.1.1", 21, "", "thedeavmi", "Tristan Brice Birchwood Kildaire");
    assert(false);
}
catch(BirchwoodException e)
{
    assert(e.getType() == ErrorType.INVALID_CONN_INFO);
}

Meta