Added port handling support for UNIX systems and moved it to the constructor
diff --git a/system/database/drivers/mssql/mssql_driver.php b/system/database/drivers/mssql/mssql_driver.php
index 611a4af..c273323 100644
--- a/system/database/drivers/mssql/mssql_driver.php
+++ b/system/database/drivers/mssql/mssql_driver.php
@@ -57,6 +57,16 @@
 	protected $_count_string = 'SELECT COUNT(*) AS ';
 	protected $_random_keyword = ' NEWID()';
 
+	public function __construct($params)
+	{
+		parent::__construct($params);
+
+		if ( ! empty($this->port) && ctype_digit($this->port))
+		{
+			$this->hostname .= (DIRECTORY_SEPARATOR === '\\' ? ',' : ':').$this->port;
+		}
+	}
+
 	/**
 	 * Non-persistent database connection
 	 *
@@ -64,11 +74,6 @@
 	 */
 	public function db_connect()
 	{
-		if ($this->port != '')
-		{
-			$this->hostname .= ','.$this->port;
-		}
-
 		return @mssql_connect($this->hostname, $this->username, $this->password);
 	}
 
@@ -81,11 +86,6 @@
 	 */
 	public function db_pconnect()
 	{
-		if ($this->port != '')
-		{
-			$this->hostname .= ','.$this->port;
-		}
-
 		return @mssql_pconnect($this->hostname, $this->username, $this->password);
 	}