S
Szafranr
Hi
I have application where I used tcpListener to connect with another system.
Every thing is ok that it's time to error handling
and I have problem
when the TCP client is disconect I don't know how detect this situation
the same situation is when I plug out patch-cord
For waiting for a data I use this loop
While Me.mSocket.Connected
Try
Thread.Sleep(100)
If Me.mSocket.Available > 0 Then
Dim lBuffer(Me.mSocket.Available) As Byte
Me.mSocket.Receive(lBuffer)
If lBuffer.Length > 0 Then
mstrDataIn =
System.Text.ASCIIEncoding.ASCII.GetString(lBuffer)
RaiseEvent DataReceived(mstrDataIn)
mstrDataIn = ""
End If
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End While
all the time mSocket(TcpListener) has Connected = True even when I disconect
How I can detect this situation?
Regards
Szafranr
I have application where I used tcpListener to connect with another system.
Every thing is ok that it's time to error handling
and I have problem
when the TCP client is disconect I don't know how detect this situation
the same situation is when I plug out patch-cord
For waiting for a data I use this loop
While Me.mSocket.Connected
Try
Thread.Sleep(100)
If Me.mSocket.Available > 0 Then
Dim lBuffer(Me.mSocket.Available) As Byte
Me.mSocket.Receive(lBuffer)
If lBuffer.Length > 0 Then
mstrDataIn =
System.Text.ASCIIEncoding.ASCII.GetString(lBuffer)
RaiseEvent DataReceived(mstrDataIn)
mstrDataIn = ""
End If
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End While
all the time mSocket(TcpListener) has Connected = True even when I disconect
How I can detect this situation?
Regards
Szafranr