// Create an instance of the endpoint object iPortNo = int.Parse(txtPort.Text); sIPAddress = txtIP.Text; IPEndPoint oEndPoint = new IPEndPoint(IPAddress.Parse(sIPAddress), iPortNo); oServer.BeginConnect(IPEndPoint, new AsyncCallback(Connected), oServer);