Socket issues

twistedduck9 the.one.duckenator at googlemail.com
Sat Jan 17 22:52:15 CET 2009


On 17 Jan, 21:32, Jeff McNeil <j... at jmcneil.net> wrote:
> 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

I seriously love you now. I still don't understand why it worked
before... Also, does this IP tables thing mean that there WAS a
firewall blocking the connection? If so, I think I'll have a go at my
hosting provider...
iptables -I RH-Firewall-1-INPUT 1 -p tcp --dport 2727 -j ACCEPT

Thank you for your response, you've saved many hours of pulling my
hair out.

Sunil

(I think I may have replied in the wrong place, I haven't used groups
before)



More information about the Python-list mailing list