title: Forward the data to another server using sockets in Vb.NET
body: <p>I'm trying to test a scenario where one server accepts multiple connections or multiples clients. </p>
  
  <p>The purpose is forwarded the data to another server with a different IP and different port. At the time of forwarding the data whenever I view different connections on the other server.</p>
  
  <p>This is my code:</p>
  
  <pre><code>Private Sub ConectarTcp(ByVal id_gps As String, ByVal data As String)
      Try
          With WinSockClient                
              .IPDelHost = "192.168.5.8"
              .PuertoDelHost = 3030                
              .Conectar()
          End With            
          WinSockCliente.EnviarDatos(trama)
      Catch ex As Exception
          MsgBox(ex.ToString)
      End Try
  End Sub
  
  Public Sub Conectar()
      Dim tcpClnt As TcpClient
      Dim tcpThd As Thread 
  
      tcpClnt = New TcpClient()      
  
      tcpClnt.Connect(IPDelHost, PuertoDelHost)
      Stm = tcpClnt.GetStream()
  
  
      tcpThd = New Thread(AddressOf LeerSocket)
      tcpThd.Start()
  
  End Sub
  
  
  
  Public Sub EnviarDatos(ByVal Datos As String)
      Dim BufferDeEscritura() As Byte
      BufferDeEscritura = Encoding.ASCII.GetBytes(Datos)
      If Not (Stm Is Nothing) Then
          'Envio los datos al Servidor 
          Stm.Write(BufferDeEscritura, 0, BufferDeEscritura.Length)
      End If
  End Sub
  </code></pre>