File: server2.py

package info (click to toggle)
pyro4 4.82-2
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 2,528 kB
  • sloc: python: 17,736; makefile: 169; sh: 113; javascript: 62
file content (25 lines) | stat: -rw-r--r-- 690 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import Pyro4


class CallbackServer(object):
    @Pyro4.expose
    @Pyro4.oneway
    def doCallback(self, callback):
        print("\n\nserver: doing callback 1 to client")
        try:
            callback.call1()
        except:
            print("got an exception from the callback:")
            print("".join(Pyro4.util.getPyroTraceback()))
        print("\n\nserver: doing callback 2 to client")
        try:
            callback.call2()
        except:
            print("got an exception from the callback:")
            print("".join(Pyro4.util.getPyroTraceback()))
        print("server: callbacks done.\n")


Pyro4.Daemon.serveSimple({
    CallbackServer: "example.callback2"
})