Socket issues

Jeff McNeil jeff at jmcneil.net
Sat Jan 17 22:32:46 CET 2009


On Jan 17, 4:11 pm, twistedduck9 <the.one.duckena... at googlemail.com>
wrote:
> My hosting provider (Streamline) have said that there is no firewall
> (it's a dedicated server). Either way the code I'm using is:
>
> Listening socket:
> import socket
> mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> mysock.bind (('79.99.43.58', 2727))
> mysock.listen(1)
> while True:
>    channel, details = mysock.accept()
>    print channel.recv(100)
>    channel.send ('Got a message.')
>    channel.close()
>
> Sending socket:
> import socket
> mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> mysock.connect(('79.99.43.58', 2727))
> mysock.send('test');
> mysock.close()
>
> Thanks for the response!


Any chance you've got IP Tables running on it? I've spent hours
debugging strange problems before only for them to turn out to be
vendor default IP tables configurations (Thanks, Red Hat!). In fact,
'iptables -L -n' has turned into one of the first things I do whenever
I have any sort of problem at all.  Along the same line, could always
be a SELinux policy as well.  The second thing I usually do?
'setenforce 0.'

Also, by "doesn't work", what do you mean?  Does it just hang and
never reply? Do you get a connection refused message?

Jeff
mcjeff.blogspot.com



More information about the Python-list mailing list