VB中Winsock控件在C#中实现的问题
最近要改写一个软件,原来这个软件使用VB做的。其中的网络通信使用了Winsock控件进行TCP通信。
假设该控件名城叫tcpServer。
有一个过程如下:
Private Sub Timer2_Timer()
If tcpServer.State = 0 Then Text3 = "关闭"
If tcpServer.State = 1 Then Text3 = "打开"
If tcpServer.State = 2 Then Text3 = "侦听"
If tcpServer.State = 3 Then Text3 = "连接挂起"
If tcpServer.State = 4 Then Text3 = "识别主机"
If tcpServer.State = 5 Then Text3 = "已识别主机"
If tcpServer.State = 6 Then Text3 = "正在连接"
If tcpServer.State = 7 Then Text3 = "已连接"
If tcpServer.State = 8 Then Text3 = "正在关闭"
If tcpServer.State = 9 Then Text3 = "错误"
End Sub
该过程通过Timer控件不断的改写实时的通信状态。
在C#下面,我使用了TCPClinet来实现通信。可是发现,TCPClinet的状态只能通过Connected属性获得一个bool值。也就是说,我只可以得到两个状态。
请问,我如何能得到其他状态,或者谁来告诉我,这个已经是不必要的了,但是要说清楚原因哦。