Your code connects to port 1024 of the host (192.168.1.7)
int port = 1024;
TcpClient client = new TcpClient(server, port);
According to exception - no service listens on this port at this host.
You can check if this port is open using telnet program
telnet 192.168.1.7 1024
To resolve - ensure, that on host some application listens to this port.