-
Notifications
You must be signed in to change notification settings - Fork 19
/
conch_snippet.txt
30 lines (30 loc) · 1.03 KB
/
conch_snippet.txt
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
26
27
28
29
30
>>> from twisted.spread import pb
>>> from twisted.internet import reactor
>>>
>>> factory = pb.PBClientFactory()
>>> server = None
>>>
>>> def gotServer(serv):
... global server
... server = serv
...
>>> connection = reactor.connectTCP('localhost', 8000, factory)
>>> d = factory.getRootObject()
>>> d.addCallback(gotServer)
<Deferred at 0xc227a0 current result: None>
>>> server.callRemote('GameStartRequest')
<Deferred #0>
Deferred #0 called back: 1
>>> up, right, down, left = 0,1,2,3
>>> server.callRemote('CharactorMoveRequest', up)
<Deferred #1>
Deferred #1 called back: 1
>>> server.callRemote('CharactorMoveRequest', right)
<Deferred #2>
Deferred #2 called back: 1
>>> server.callRemote('CharactorMoveRequest', down)
<Deferred #3>
Deferred #3 called back: 1
>>> server.callRemote('CharactorMoveRequest', left)
<Deferred #4>
Deferred #4 called back: 1