This Python3 code can be used to establish a TCP connection between Server and Client for real-time data transfer. Make sure that Client and Server can ping eachother (You may need to turn off Windows firewall). Run Server first and then run the Client file to establish the communication link.
In my case, I used Raspberry Pi 3 as server and my Laptop as client.