I've got an application using a TCP connection to communicate. When using this application on a Windows 7 machine it will send the data. But when I use the same application on a Windows 8.1 machine it will connect to the server, but it will not send the data.
I've checked how the application connects to the server and on Windows 7 and 8.1 this is the same.
Any ideas why this problem occurs?
Here is the code for the connection class:
public class TcpCon
{
private TcpClient tcpClient;
public bool Connected
{
get
{
if(tcpClient != null)
return tcpClient.Connected;
return false;
}
}
public void Connect(String ipAddr, int port)
{
if (tcpClient == null)
{
tcpClient = new TcpClient();
tcpClient.Connect(ipAddr, port);
}
}
public void Disconnect()
{
if (tcpClient != null)
{
tcpClient.Close();
}
}
public void Send(Byte[] byteArr)
{
NetworkStream strWrite = tcpClient.GetStream();
if (strWrite.CanWrite)
{
strWrite.Write(byteArr, 0, byteArr.Length);
strWrite.Flush();
}
}
}