PDA

View Full Version : unable to open port and connect to machine


marlonjm
2007-10-30, 11:20 PM CDT
I am unable to open a port in Fedora 7 to use a tracking application. The application server is running on the Fedora box and can connect locally, but the client from win or mac boxes is not able to connect. I am also not able to connect through telnet. The application is using simple xmlrpc.

I have turned off the firewall, iptables, and selinux and still am not able to connect. Making any changes through the gui or command line to open a port, is not holding.

Using this sample code from
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/81549/index_txt

Code: ( text )

1. # Server code

2.

3. import SimpleXMLRPCServer

4.

5. class StringFunctions:

6. def __init__(self):

7. # Make all of the Python string functions available through

8. # python_string.func_name

9. import string

10. self.python_string = string

11.

12. def _privateFunction(self):

13. # This function cannot be called through XML-RPC because it

14. # starts with an '_'

15. pass

16.

17. def chop_in_half(self, astr):

18. return astr[:len(astr)/2]

19.

20. def repeat(self, astr, times):

21. return astr * times

22.

23. server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8000))

24. server.register_instance(StringFunctions())

25. server.register_function(lambda astr: '_' + astr, '_string')

26. server.serve_forever()

Code: ( text )

1. # Client code

2.

3. import xmlrpclib

4.

5. server = xmlrpclib.Server('http://localhost:8000')

6. print server.chop_in_half('I am a confidant guy')

7. print server.repeat('Repetition is the key to learning!\n', 5)

8. print server._string('<= underscore')

9. print server.python_string.join(['I', 'like it!'], " don't ")

10. print server._privateFunction() # Will throw an exception



I can get XP machines to talk to each other and if I run it on the linux server it connects to itself, but if I try and get XP->Linux or Linux->XP I get connection errors such as

socket.error: (10061, 'connection refused')
or
socket.error: (10060, 'Operation timed out')

If I try and run the server on a port on the linux box and then from xp try to telnet to it, I get
Connecting To Linux-Server...Could not open connection to the host, on port 55670: Connect failed

But if I try to telnet from XP to the server running on a port on another XP machine, I can connect and when I type garbage I get a response, in the form of an error and the server prints out what I typed..
eg response = Message: Bad request syntax ('ssdsadsdasdasdasdasdasdasd')
server message = <my computer> - - [30/Oct/2007 17:06:50] code 400, message Bad request syntax ('ssdsadsdasdasdasdasdasdasd')

So what I need help with is what is going on with the connection between the two different operating systems? Is there anything I can try/read/look at to get this stuff working, as we/I am really stumped here. I have been trawling the internet for anything that will help and I have got nowhere.

stevea
2007-10-31, 12:09 AM CDT
"localhost" only refers to the local system, "lo" (127.0.0.1) interface so no process is listening on the external hardware line (eth0 or whatever).

Try this on the server:
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("", 8000))

And on the client you'll need something like:
server = xmlrpclib.Server('http://192.168.1.44:8000')
but you need to insert the server IP or hostname.