Commit e0c104ab authored by Michael Alexander's avatar Michael Alexander
Browse files

add server down exception client

parent 1dcd00c1
......@@ -15,21 +15,27 @@ Public Class NetIO
End Sub
Public Function SendRecv(ByVal param As Object) As String
Dim toSend As String
toSend = JsonConvert.SerializeObject(param)
Dim OutStream As Byte() = Encoding.UTF8.GetBytes(toSend)
Dim ReceivedData As String
Try
Dim inStream(100000) As Byte
ServerStream = ClientSocket.GetStream()
Dim inStream(100000) As Byte
ServerStream = ClientSocket.GetStream()
ServerStream.Write(OutStream, 0, OutStream.Length)
ServerStream.Flush()
ServerStream.Write(OutStream, 0, OutStream.Length)
ServerStream.Flush()
ServerStream.Read(inStream, 0, CInt(ClientSocket.ReceiveBufferSize))
ReceivedData = Encoding.UTF8.GetString(inStream)
ServerStream.Read(inStream, 0, CInt(ClientSocket.ReceiveBufferSize))
ReceivedData = Encoding.UTF8.GetString(inStream)
Catch ex As Exception
ReceivedData = "{""status"": ""error""}"
End Try
Return ReceivedData
End Function
End Class
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment