The goal is an vb.net connection between windows and linux.
windows-server (vb.net): The server should listen on port 4001/tcp for connections and do something with the packets.
Dim serverstream As NetworkStream
Dim serverstreamw As StreamWriter
Dim serverstreamr As StreamReader
Dim Server As TcpListener
Dim serverclient As New TcpClient
Dim ipendpoint As IPEndPoint = New IPEndPoint(IPAddress.Any, 4001)
Dim mainthread As Threading.Thread
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
mainthread = New Threading.Thread(AddressOf mainserver)
mainthread.Start()
End Sub
Sub mainserver()
Try
Server = New TcpListener(ipendpoint)
Server.Start()
serverclient = Server.AcceptTcpClient
serverstream = serverclient.GetStream
serverstreamr = New StreamReader(serverstream)
serverstreamw = New StreamWriter(serverstream)
While True
Select Case serverstreamr.ReadLine
Case "onl" '........
Case "logoff" '........
Case "iamhere" '........
MessageBox.Show("WORKS!!!")
End Select
End While
Catch
End Try
End Sub
linux-client: The client should create an connection with the server and send him packets.
echo "iamhere" > /dev/tcp/client.ip/4001
The problem is that it seems like the server does not open port 4001/tcp. The client gets no connection :/
How to fix that?
IPAddress.Any
says to listen on all connections, doesn't it? So it needs to listen on all IP's bc of various clients :) – realKSMC