What's wrong with this please? It throws this error: "Attempting to deserialize an empty stream" at server side in this line when I run the server: "this.tcpListener.Start();" This is my internet IP, if I use my local IP, it works. But i want the internet IP.
Client side:
TcpClient tcpclnt = new TcpClient();
Console.WriteLine("Connecting.....");
tcpclnt.Connect("187.115.131.44", 8001);
Server side:
public Server()
{
try
{
IPAddress ip = IPAddress.Parse("187.115.131.44");
tcpListener = new TcpListener(ip, 8001);
listenThread = new Thread(new ThreadStart(ListenForClients));
listenThread.Start();
}
catch (Exception e)
{
Console.WriteLine("Error..... " + e.StackTrace);
Console.ReadKey();
}
}
private void ListenForClients()
{
this.tcpListener.Start();
while (true)
{
//blocks until a client has connected to the server
TcpClient client = this.tcpListener.AcceptTcpClient();
//create a thread to handle communication
//with connected client
Thread clientThread = new Thread(new ParameterizedThreadStart(HandleClientComm));
clientThread.Start(client);
}
}