use more inherit features
This commit is contained in:
@@ -44,33 +44,20 @@ Public Class TCPManager
|
||||
tcp.ReceiveBufferSize = BufferSize
|
||||
Stream.Read(buf, 0, buf.Length)
|
||||
|
||||
Dim contentstring As String = Text.Encoding.Default.GetString(buf)
|
||||
Dim content As Object = Nothing
|
||||
Dim cmd As String = String.Empty
|
||||
|
||||
Try
|
||||
Dim res = DecodeFromBytes(buf)
|
||||
cmd = res.cmd
|
||||
content = res.content
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
|
||||
tcp.Close()
|
||||
|
||||
RaiseRetriveData(ip, cmd, content)
|
||||
ProcessRetrivedData(ip, buf)
|
||||
End If
|
||||
Loop
|
||||
End Sub
|
||||
|
||||
Public Overrides Sub Send(empfängerIP As String, cmd As String, content As Object)
|
||||
Dim ep As New IPEndPoint(GetIPFromHost(empfängerIP).MapToIPv4, Port)
|
||||
Protected Overrides Sub SendData(ep As IPEndPoint, buf As Byte())
|
||||
Dim tcp As New TcpClient
|
||||
|
||||
tcp.SendBufferSize = BufferSize
|
||||
tcp.Connect(ep)
|
||||
|
||||
Dim stream As NetworkStream = tcp.GetStream()
|
||||
Dim buf As Byte() = EncodeToBytes(cmd, content, UseAssemblyQualifiedName)
|
||||
|
||||
'Send Data
|
||||
stream.Write(buf, 0, buf.Length)
|
||||
|
||||
Reference in New Issue
Block a user