你想连接基于TCP的服务端。
解决方法:
使用 System.Net.TcpClient类,通过给服务端传递地址和端口来和服务端建立连接和会话。下面这个例子将和上一菜单中的服务端进行会话。
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
Sending message to server: Just wanted to say hi
Server said: Thanks call again !
Sending message to server: Just wanted to say hi again
Server said: Thanks call again !
Sending message to server: Are you ignoring me ?
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 0)
Sending message to server: I ' ll not be ignored! (round 1)
Sending message to server: I ' ll not be ignored! (round 2)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 3)
Sending message to server: I ' ll not be ignored! (round 4)
Sending message to server: I ' ll not be ignored! (round 5)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 6)
Sending message to server: I ' ll not be ignored! (round 7)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 8)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 9)
Sending message to server: I ' ll not be ignored! (round 10)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 11)
Sending message to server: I ' ll not be ignored! (round 12)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 13)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 14)
Sending message to server: I ' ll not be ignored! (round 15)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 16)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 17)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 18)
Sending message to server: I ' ll not be ignored! (round 19)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 20)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 21)
Sending message to server: I ' ll not be ignored! (round 22)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 23)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 24)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 25)
Sending message to server: I ' ll not be ignored! (round 26)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 27)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 28)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 29)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 30)
Sending message to server: I ' ll not be ignored! (round 31)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 32)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 33)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 34)
Sending message to server: I ' ll not be ignored! (round 35)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 36)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 37)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 38)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 39)
Sending message to server: I ' ll not be ignored! (round 40)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 41)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 42)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 43)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 44)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 45)
Sending message to server: I ' ll not be ignored! (round 46)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 47)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 48)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 49)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 50)
Sending message to server: I ' ll not be ignored! (round 51)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 52)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 53)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 54)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 55)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 56)
Sending message to server: I ' ll not be ignored! (round 57)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 58)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 59)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 60)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 61)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 62)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 63)
Sending message to server: I ' ll not be ignored! (round 64)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 65)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 66)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 67)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 68)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 69)
Sending message to server: I ' ll not be ignored! (round 70)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 71)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 72)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 73)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 74)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 75)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 76)
Sending message to server: I ' ll not be ignored! (round 77)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 78)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 79)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 80)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 81)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 82)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 83)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 84)
Sending message to server: I ' ll not be ignored! (round 85)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 86)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 87)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 88)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 89)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 90)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 91)
Sending message to server: I ' ll not be ignored! (round 92)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 93)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 94)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 95)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 96)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 97)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 98)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 99)
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
线程 0xb10 已退出,返回值为 0 ( 0x0 )。
线程 ' <无名称> ' ( 0x344 ) 已退出,返回值为 0 ( 0x0 )。
线程 0xe90 已退出,返回值为 0 ( 0x0 )。
线程 ' <无名称> ' ( 0xb64 ) 已退出,返回值为 0 ( 0x0 )。
线程 0x73c 已退出,返回值为 0 ( 0x0 )。
线程 0xd9c 已退出,返回值为 0 ( 0x0 )。
线程 ' <无名称> ' ( 0xdf8 ) 已退出,返回值为 0 ( 0x0 )。
线程 0xe8c 已退出,返回值为 0 ( 0x0 )。
线程 0x204 已退出,返回值为 0 ( 0x0 )。
线程 0xc54 已退出,返回值为 0 ( 0x0 )。
线程 0xad0 已退出,返回值为 0 ( 0x0 )。
线程 ' <无名称> ' ( 0xd34 ) 已退出,返回值为 0 ( 0x0 )。
线程 0xce8 已退出,返回值为 0 ( 0x0 )。
线程 0xe88 已退出,返回值为 0 ( 0x0 )。
线程 0xb6c 已退出,返回值为 0 ( 0x0 )。
线程 0xaa8 已退出,返回值为 0 ( 0x0 )。
线程 0xf4 已退出,返回值为 0 ( 0x0 )。
线程 0xae4 已退出,返回值为 0 ( 0x0 )。
线程 0x6f8 已退出,返回值为 0 ( 0x0 )。
线程 ' <无名称> ' ( 0x6c4 ) 已退出,返回值为 0 ( 0x0 )。
线程 0xcfc 已退出,返回值为 0 ( 0x0 )。
线程 0x504 已退出,返回值为 0 ( 0x0 )。
讨论:
Server said: Thanks call again !
Sending message to server: Just wanted to say hi again
Server said: Thanks call again !
Sending message to server: Are you ignoring me ?
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 0)
Sending message to server: I ' ll not be ignored! (round 1)
Sending message to server: I ' ll not be ignored! (round 2)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 3)
Sending message to server: I ' ll not be ignored! (round 4)
Sending message to server: I ' ll not be ignored! (round 5)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 6)
Sending message to server: I ' ll not be ignored! (round 7)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 8)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 9)
Sending message to server: I ' ll not be ignored! (round 10)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 11)
Sending message to server: I ' ll not be ignored! (round 12)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 13)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 14)
Sending message to server: I ' ll not be ignored! (round 15)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 16)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 17)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 18)
Sending message to server: I ' ll not be ignored! (round 19)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 20)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 21)
Sending message to server: I ' ll not be ignored! (round 22)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 23)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 24)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 25)
Sending message to server: I ' ll not be ignored! (round 26)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 27)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 28)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 29)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 30)
Sending message to server: I ' ll not be ignored! (round 31)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 32)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 33)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 34)
Sending message to server: I ' ll not be ignored! (round 35)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 36)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 37)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 38)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 39)
Sending message to server: I ' ll not be ignored! (round 40)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 41)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 42)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 43)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 44)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 45)
Sending message to server: I ' ll not be ignored! (round 46)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 47)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 48)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 49)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 50)
Sending message to server: I ' ll not be ignored! (round 51)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 52)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 53)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 54)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 55)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 56)
Sending message to server: I ' ll not be ignored! (round 57)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 58)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 59)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 60)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 61)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 62)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 63)
Sending message to server: I ' ll not be ignored! (round 64)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 65)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 66)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 67)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 68)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 69)
Sending message to server: I ' ll not be ignored! (round 70)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 71)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 72)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 73)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 74)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 75)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 76)
Sending message to server: I ' ll not be ignored! (round 77)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 78)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 79)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 80)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 81)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 82)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 83)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 84)
Sending message to server: I ' ll not be ignored! (round 85)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 86)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 87)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 88)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 89)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 90)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 91)
Sending message to server: I ' ll not be ignored! (round 92)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 93)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 94)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 95)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 96)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 97)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 98)
Server said: Thanks call again !
Sending message to server: I ' ll not be ignored! (round 99)
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
Server said: Thanks call again !
线程 0xb10 已退出,返回值为 0 ( 0x0 )。
线程 ' <无名称> ' ( 0x344 ) 已退出,返回值为 0 ( 0x0 )。
线程 0xe90 已退出,返回值为 0 ( 0x0 )。
线程 ' <无名称> ' ( 0xb64 ) 已退出,返回值为 0 ( 0x0 )。
线程 0x73c 已退出,返回值为 0 ( 0x0 )。
线程 0xd9c 已退出,返回值为 0 ( 0x0 )。
线程 ' <无名称> ' ( 0xdf8 ) 已退出,返回值为 0 ( 0x0 )。
线程 0xe8c 已退出,返回值为 0 ( 0x0 )。
线程 0x204 已退出,返回值为 0 ( 0x0 )。
线程 0xc54 已退出,返回值为 0 ( 0x0 )。
线程 0xad0 已退出,返回值为 0 ( 0x0 )。
线程 ' <无名称> ' ( 0xd34 ) 已退出,返回值为 0 ( 0x0 )。
线程 0xce8 已退出,返回值为 0 ( 0x0 )。
线程 0xe88 已退出,返回值为 0 ( 0x0 )。
线程 0xb6c 已退出,返回值为 0 ( 0x0 )。
线程 0xaa8 已退出,返回值为 0 ( 0x0 )。
线程 0xf4 已退出,返回值为 0 ( 0x0 )。
线程 0xae4 已退出,返回值为 0 ( 0x0 )。
线程 0x6f8 已退出,返回值为 0 ( 0x0 )。
线程 ' <无名称> ' ( 0x6c4 ) 已退出,返回值为 0 ( 0x0 )。
线程 0xcfc 已退出,返回值为 0 ( 0x0 )。
线程 0x504 已退出,返回值为 0 ( 0x0 )。
MyTcpClient.ConnectToServer是被设计用来发送一条消息,获得响应,显示响应的内容,然后关闭连接。为了完成这些,它创建一个 System.Net.TcpClient并通过调用 TcpClient.Connect连接到服务端。Connect通过 IPEndPoint定位到服务端,IPEndPoint是根据你传递给MyTcpClient的构造函数的参数(IP地址和端口)确定的。
MyTcpClient.ConnectToServer然后用 Encoding.ASCII.GetBytes 从string中取得bytes。一旦有bytes要发送,它通过调用 System.Net.TcpClient的GetStream方法来获取 NetworkStream,然后通过 TcpClient.Write方法来发送消息。
为了中服务端收到响应,阻塞函数 TcpClient.Read被调用。然后连接被关闭,客户端结束。
写一个TCP服务端