Torna al Thread
Function readData(ByRef objStream As NetworkStream, ByRef objTcpClient As TcpClient) As String
Dim objStreamReader As New System.IO.StreamReader(objStream) 'streamreader per la lettura dei caratteri da un flusso di byte
Dim sBuffer As String = Nothing
objStream.ReadTimeout = 2000
Try
sBuffer = objStreamReader.ReadToEnd
'write_Log("[iIntRead]: " + iIntRead.ToString + vbNewLine)
Catch ex As IOException 'cattura dell'eccezione di tipo IOException
'write_Log("[Errore] : timeout scaduto" + vbNewLine)
End Try
objStreamReader.Dispose() ' rilascio delle risorse
objStreamReader.Close() ' chiusura dello streamreader
Return sBuffer
End Function