S
slb302
Unregistered / Unconfirmed
GUEST, unregistred user!
,以下是服务器端的监听
Public Sub establistsocket(ByVal state As Object)
Dim StrName As String
Dim StrIP As String
Dim Address() As System.Net.IPAddress
While run
listener = New socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
StrName = Dns.GetHostName()
Address = Dns.GetHostByName(StrName).AddressList
StrIP = Address(0).ToString
Dim serveradd As IPAddress = Dns.Resolve(StrIP).AddressList(0)
Dim enpoint As New IPEndPoint(serveradd, 1101) '设置端口
listener.Bind(enpoint) '绑定本机的IP地址
listener.Listen(0) '侦听
socket(socketCount) = listener.Accept '接收连接请求,并实例化一个Socket对象
listener.Close() '关闭侦听
socketCount = socketCount + 1
End While
End Sub
请问当我和很多客户都建立连接之后,当其中有一个和多个客户端断开连接之后,我在服务器端怎么判断哪个客户端已经断开连接
Public Sub establistsocket(ByVal state As Object)
Dim StrName As String
Dim StrIP As String
Dim Address() As System.Net.IPAddress
While run
listener = New socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
StrName = Dns.GetHostName()
Address = Dns.GetHostByName(StrName).AddressList
StrIP = Address(0).ToString
Dim serveradd As IPAddress = Dns.Resolve(StrIP).AddressList(0)
Dim enpoint As New IPEndPoint(serveradd, 1101) '设置端口
listener.Bind(enpoint) '绑定本机的IP地址
listener.Listen(0) '侦听
socket(socketCount) = listener.Accept '接收连接请求,并实例化一个Socket对象
listener.Close() '关闭侦听
socketCount = socketCount + 1
End While
End Sub
请问当我和很多客户都建立连接之后,当其中有一个和多个客户端断开连接之后,我在服务器端怎么判断哪个客户端已经断开连接