因为没有异常发生啊
Exceptions有三个:
ArgumentNullException- The hostname parameter is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeException- The port parameter is not between MinPort and MaxPort.
SocketException- An operating system error occurred while accessing the socket.
你的没问题,当然不会报错了
Exceptions有三个:
ArgumentNullException- The hostname parameter is a null reference (Nothing in Visual Basic).
ArgumentOutOfRangeException- The port parameter is not between MinPort and MaxPort.
SocketException- An operating system error occurred while accessing the socket.
你的没问题,当然不会报错了
try
{
TcpClient MyTcpClient = new TcpClient() ;
MyTcpClient.Connect(PopServerAddress,110) ;
MessageBox.Show("服务器连接成功") ;
}
catch(Exception Err)
{
MessageBox.Show("服务器暂时无法连接," + Err.ToString()) ;
}
不管PopServerAddress是什么,都会提示连接成功,到底什么地方错了呀---------------------------------------------------------------把你的catch(Exception Err)
改为catch(SocketException Err)
试试。