Apenas inicio en esto, pero te puede ayudar este scrip
Const portNumber As Integer = 13
Dim tcpListener As New TcpListener(portNumber)
tcpListener.Start()
Console.WriteLine("Waiting for a connection....")
Try
'Accept the pending client connection and return a TcpClient initialized for communication.
Dim tcpClient As TcpClient = tcpListener.AcceptTcpClient()
Console.WriteLine("Connection accepted.")
Dim networkStream As NetworkStream = tcpClient.GetStream()
Dim responseString As String = "You have successfully connected to me."
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(responseString)
networkStream.Write(sendBytes, 0, sendBytes.Length)
Console.WriteLine(("Message Sent /> : " + responseString))
'Any communication with the remote client using the TcpClient can go here.
'
'//////
'Close TcpListener and TcpClient.
tcpClient.Close()
tcpListener.Stop()
Catch e As Exception
Console.WriteLine(e.ToString())
End Try
[C#]
const int portNumber = 13;
TcpListener tcpListener = new TcpListener(portNumber);
tcpListener.Start();
Console.WriteLine("Waiting for a connection....");
try{
Saludos de Guatemala
Byron Gomez