Sounds like you have a firewall running on your server. Use "sudo iptables -L" to list the current ruleset. You might also want to run wireshark or tcpdump on the server to validate the client is sending data packets to the server correctly. In any case, I don't see anything wrong with your python code.
Jeremiah Bess <https://plus.google.com/u/0/103182072532361592558> <https://www.facebook.com/jeremiahbess> <http://www.linkedin.com/profile/view?id=47451026> On Sun, Mar 29, 2015 at 6:26 AM, bobby <[email protected]> wrote: > 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, > > 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 : > > 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 > > -- > -- > You received this message because you are subscribed to the Linux Users > Group. > To post a message, send email to [email protected] > To unsubscribe, send email to [email protected] > For more options, visit our group at > http://groups.google.com/group/linuxusersgroup > References can be found at: http://goo.gl/anqri > Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules > or http://cdn.fsdev.net/List-Rules.pdf) > > --- > You received this message because you are subscribed to the Google Groups > "Linux Users Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup References can be found at: http://goo.gl/anqri Please remember to abide by our list rules (http://tinyurl.com/LUG-Rules or http://cdn.fsdev.net/List-Rules.pdf) --- You received this message because you are subscribed to the Google Groups "Linux Users Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
