16,554
社区成员
发帖
与我相关
我的任务
分享
Try
Dim read As Integer = s.EndReceive(ar)
If read > 0 Then
so.sb.Append(Encoding.ASCII.GetString(so.buffer, 0, read))
If so.sb.Length > 1 Then
'All the data has been read, so displays it to the console
Dim strContent As String
strContent = Encoding.Unicode.GetString(so.buffer, 0, read)
txtOutput.Invoke(New ChangeTextDelegate(AddressOf ChangeTextInvoke), New Object() {Me.txtOutput, strContent})
End If
Array.Clear(so.buffer, 0, StateObject.BUFFER_SIZE)
s.BeginReceive(so.buffer, 0, so.buffer.Length, 0, New AsyncCallback(AddressOf ReceiveMessage), so)
End If
Catch ex2 As System.Net.Sockets.SocketException
Debug.WriteLine(ex2.ErrorCode)
Catch ex As Exception
Debug.WriteLine(ex.ToString)