Int to String and back to Int

I’ve been looking up a bunch of different stuff but nothing seems to be working. I’ve tried port.ToString(); and other pieces of code to try making it so the user is able to edit the text field and then right before they hit connect convert it back to an int so it can start the network. Nothing seems to be working and keep getting int can’t be converted to a string.

var ipAddress : String = "127.0.0.1";
var port : int = 25000;
var maxConnections : int = 10;


function OnGUI () {

GUILayout.BeginHorizontal ();
ipAddress = GUILayout.TextField (ipAddress);
GUILayout.Label ("IP ADDRESS");
GUILayout.EndHorizontal ();

GUILayout.BeginHorizontal ();
port = GUILayout.TextField (port);
GUILayout.Label ("PORT");
GUILayout.EndHorizontal();

if(GUILayout.Button ("CONNECT")) {
print("connecting... ");
Network.Connect (ipAddress, port);
}

if(GUILayout.Button ("START SERVER")) {
print("starting server on" + ipAddress + ":" + port);
Network.InitializeServer (maxConnections, port);

}




}

function OnConnectedToServer () {
print("connected");


}

System.Int32.TryParse(someString, outputInteger) is what you are looking for.