0

I'm trying to get an IBM tutorialworks example working but until now there hasn't been any luck

server:

import calendar, SimpleXMLRPCServer

#The server object
class Calendar:
    def getMonth(self, year, month):
        return calendar.month(year, month)

    def getYear(self, year):
        return calendar.calendar(year)


calendar_object = Calendar()
server = SimpleXMLRPCServer.SimpleXMLRPCServer(("localhost", 8888))
server.register_instance(calendar_object)

#Go into the main listener loop
print "Listening on port 8888"
server.serve_forever()

Client:

import xmlrpclib

server = xmlrpclib.ServerProxy("http://localhost:8888")

month = server.getMonth(2002, 8)
print month

It should print out a calendar but it just stalls when I run the client and prints out only "Listening on port 8000"

I'm using python 2.7.2 but the tutorial was written in 2002 september. Is there somekind of syntax difference or I'm doing something wrong.

The tutorial itself is located here http://www.ibm.com/developerworks/webservices/library/ws-pyth10/index.html

Thanks in advance!

nils
  • 335
  • 3
  • 5
  • 15
  • The server code looks fine. Where is the client running? Try a trailing slash on the URL just in case. – wberry Oct 26 '11 at 17:09
  • just ran the server from a folder and then ran the client.py also. Now the client.py doesn't show anything, just idleing. – nils Oct 26 '11 at 17:13
  • I just checked. Code runs perfectly fine on my OSX Leapord with python 2.6.1 – shadyabhi Oct 26 '11 at 17:20

1 Answers1

1

My guess is that something is blocking the low-level bind call to port 8888 in your server process. Run netstat -tlp as root if you can. If you can't, use telnet localhost 8888 to see what if anything is listening.

wberry
  • 18,519
  • 8
  • 53
  • 85
  • Checked and nothing was using port 8888 Changed the ports to 8000 in client and server, then changed them back to 8888 and now everything works :/ – nils Oct 26 '11 at 17:21
  • adobe activation uses port 8888 and that was interfering with the python code – nils Oct 26 '11 at 17:24