Пример #1
0
 def login(self):
     host = self.hostname.get()
     port = self.port.get()
     service = self.service.get()
     try:
         port = int(port)
     except:
         pass
     user = self.username.get()
     pswd = self.password.get()
     pb.connect(host, port, user, pswd, service,
                client=self.pbReferenceable).addCallback(self.pbCallback).addErrback(
         self.couldNotConnect)
Пример #2
0
 def login(self):
     host = self.hostname.get()
     port = self.port.get()
     service = self.service.get()
     try:
         port = int(port)
     except:
         pass
     user = self.username.get()
     pswd = self.password.get()
     pb.connect(host, port, user, pswd, service,
                client=self.pbReferenceable).addCallback(self.pbCallback).addErrback(
         self.couldNotConnect)
Пример #3
0
 def doLogin(self, *ev):
     username = self.username.get()
     hostname = self.hostname.get()
     try:
         port = int(self.port.get())
     except:
         port = self.port.get()
     password = self.password.get()
     self.m = MainWindow()
     self.m.withdraw()
     # he's a hack, he's a hack
     pb.connect(self.m.loggedIn, self.m.tryAgain, hostname, port, username,
                password, self.worldname.get(), username, self.m, 60)
Пример #4
0
 def __init__(self,im,server=None,port=None,username=None,password=None,service=None):
     self.im=im
     self.service=service
     self.username=username
     self.attached=0
     self.ref=WordsGateway(username)
     pb.connect(
         self.pbCallback, self.connectionFailed,
         server, int(port),
         username, password,
         service, username, # need to fix this, maybe?
         self.ref, 60
         )
     self.connected=1
Пример #5
0
 def doLogin(self, *ev):
     username=self.username.get()
     hostname=self.hostname.get()
     try:
         port=int(self.port.get())
     except:
         port = self.port.get()
     password=self.password.get()
     self.m = MainWindow()
     self.m.withdraw()
     # he's a hack, he's a hack
     pb.connect(self.m.loggedIn, self.m.tryAgain,
                hostname, port,
                username, password,
                self.worldname.get(), username, self.m, 60)
Пример #6
0
 def startConnecting(self):
     log.msg('PerspectiveConnector: connecting: %s:%s %s/%s/%s' %
             (self.host, self.port, self.serviceName, self.username,
              self.perspectiveName))
     return pb.connect(self.host, self.port, self.username, self.password,
                       self.serviceName, self.perspectiveName,
                       self.client).addCallbacks(self._cbConnected,
                                                 self._ebConnected)
Пример #7
0
 def testConnect(self):
     d = pb.connect("127.0.0.1",
                    self.portno,
                    "guest",
                    "guest",
                    "test",
                    perspectiveName="any")
     d.addCallback(self.addRef)
     d.addCallback(self._checkIsRemoteReference)
     return d
Пример #8
0
 def __init__(self,
              im,
              server=None,
              port=None,
              username=None,
              password=None,
              service=None):
     self.im = im
     self.service = service
     self.username = username
     self.attached = 0
     self.ref = WordsGateway(username)
     pb.connect(
         self.pbCallback,
         self.connectionFailed,
         server,
         int(port),
         username,
         password,
         service,
         username,  # need to fix this, maybe?
         self.ref,
         60)
     self.connected = 1
Пример #9
0
    def Notify(self, event):
        ev = event
        #if isinstance( event, FlipCardRequest):
        #print "888888888888888888888888"

        if isinstance( event, TickEvent ) \
           and self.state == NetworkServerView.STATE_PREPARING:
            self.state = NetworkServerView.STATE_CONNECTING

            #remoteResponse = pb.getObjectAt("localhost", 8000, 30)
            remoteResponse = pb.connect("localhost",
                                        8000,
                                        "user1",
                                        "asdf",
                                        "myService",
                                        "perspective1",
                                        timeout=30)

            remoteResponse.addCallback(self.Connected)
            #errback                  #self.ConnectFailed)

        #see if it's Copyable.  If not, see if there's a Copyable
        #replacement for it.  If not, just ignore it.
        if not isinstance(event, pb.Copyable):
            evName = event.__class__.__name__
            if not hasattr(network, "Copyable" + evName):
                return
            copyableClass = getattr(network, "Copyable" + evName)
            if copyableClass not in clientToServerEvents:
                return
            ev = copyableClass(event, self.sharedObjs)

        elif ev.__class__ not in clientToServerEvents:
            print "CLIENT NOT SENDING: " + str(ev)
            return

        print "<== Sending to server:", ev.name
        remoteCall = self.server.callRemote("ClientEvent", ev,
                                            self.clientController)
Пример #10
0
 def testConnect(self):
     p = dR(pb.connect("127.0.0.1", self.portno, "guest", "guest", "test",
                       perspectiveName="any"))
     self.assert_(isinstance(p, pb.RemoteReference))
     p.broker.transport.loseConnection()
Пример #11
0
 def testConnect(self):
     d = pb.connect("127.0.0.1", self.portno, "guest", "guest", "test",
                    perspectiveName="any")
     d.addCallback(self.addRef)
     d.addCallback(self._checkIsRemoteReference)
     return d
Пример #12
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

from twisted.spread import pb
from twisted.internet import main


def success(message):
    print "Message received:", message
    main.shutDown()


def failure(error):
    print "Failure...", error
    main.shutDown()


def connected(perspective):
    perspective.echo("hello world", pbcallback=success, pberrback=failure)
    print "connected."


pb.connect(connected, failure, "localhost", pb.portno, "guest", "guest",
           "pbecho", "guest", 30)
main.run()
Пример #13
0
 def getEchoPerspective(self):
     d = defer.Deferred()
     pb.connect(d.callback, d.errback, "localhost", pb.portno,
                "guest", "guest",      "pbecho", "guest", 1)
     d.addCallbacks(self.makeListOf, self.formatTraceback)
     return ['<b>',d,'</b>']
Пример #14
0
# 
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

from twisted.spread import pb
from twisted.internet import main
def success(message):
    print "Message received:",message
    main.shutDown()
def failure(error):
    print "Failure...",error
    main.shutDown()
def connected(perspective):
    perspective.echo("hello world",
                     pbcallback=success,
                     pberrback=failure)
    print "connected."
pb.connect(connected, failure,   "localhost", pb.portno,
           "guest", "guest",     "pbecho", "guest", 30)
main.run()
Пример #15
0
 def connect(self):
     print 'connecting as', self.name
     d = pb.connect("localhost", 8800, self.name, 'guest',
                          "TwistTacToeService")
     d.addCallback(self.connected)
     d.addErrback(self.connectionFailed)
Пример #16
0
 def connectVideoServer(self): 
     pb.connect("localhost",8788,
         "video", "****",
         "video_server",'video', 2).addCallbacks(self.registerVideoServer)
Пример #17
0
 def connect(self, name, passwd):
     self.d = pb.connect("localhost",
                             8800, name, passwd, "pygameservice")
     self.d.addCallback(self.join)
     self.d.addErrback(self.join_failed)
     self.d.addCallback(self.givePlayerGame)
Пример #18
0
 def getEchoPerspective(self):
     d = defer.Deferred()
     pb.connect(d.callback, d.errback, "localhost", pb.portno, "guest",
                "guest", "pbecho", "guest", 1)
     d.addCallbacks(self.makeListOf, self.formatTraceback)
     return ['<b>', d, '</b>']
Пример #19
0
 def startConnecting(self):
     log.msg( 'PerspectiveConnector: connecting: %s:%s %s/%s/%s' % (self.host, self.port, self.serviceName, self.username, self.perspectiveName))
     return pb.connect(self.host, self.port, self.username, self.password,
                       self.serviceName, self.perspectiveName, self.client
                       ).addCallbacks(self._cbConnected, self._ebConnected)
Пример #20
0
 def runClient(self):
     pb.connect("localhost", self.n, "guest", "guest",
                "pbfailure", "guest", 30).addCallbacks(self.connected, self.notConnected)
     self.id = reactor.callLater(10, self.timeOut)