I am trying to establish a TCP socket between my linux server and my client running on my laptop. The TCP server code I am running is,
Code:
from socket import *
HOST = ''
PORT = 1999
serversocket = socket(AF_INET,SOCK_STREAM)
serversocket.bind((HOST,PORT))
serversocket.listen(5)
while True:
(clientsocket, address) = serversocket.accept()
print ("Got client request from",address)
clientsocket.send("Thank You for connecting")
clientsocket.close()
The TCP client code I am running is :
Code:
from socket import *
clientsocket = socket(AF_INET,SOCK_STREAM)
clientsocket.connect(("my-server-ip-address",1999))
recv = clientsocket.recv(1024)
print(recv)
The problem I am facing is that I am not able to communicate with the server from my client. WHen I run both the TCP client and server code on my linux server, the communication works. So, I have narrowed down this issue to lack of open TCP ports on my server. I am using windows 8 on my laptop. I did an nmap from my laptop to my server and the list of open ports available were, 80/tcp, 443/tcp,22/tcp. So, can anyone suggest on how to add a port to the list of open ports. For example, in this case I need to add 1999 to the list of open ports.
Server version: Linux hostname 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux