def doLogin(self, widget):
        name = self.form.widget_user.text
        pwd = self.form.widget_pass.text

        Events.do('showConsole')

        print "Opening stream socket..."
        tcp = Network.TCPSocket()
        try:
            tcp.connect(Network.serverAddress)
        except:
            print "Could not connect to server."
            print "The server could be down.  Try again later."
            tcp.close()
            return 1

        print "Opening datagram socket..."
        udp = Network.UDPSocket()
        tcp.write('bindUDP %i\n' % udp.getsockname()[1])

        newUser = User.User(tcp, udp)
        newUser.name = name
        newUser.pwd = pwd
        if (widget == self.create):
            newUser.isNewUser = True
        if (self.form.widget_guest.checkState == 1):
            newUser.isGuest = True

        self.destroy()
        return 1
Example #2
0
def update():
    getDesktop().draw()
    getDesktop().update()

    r, w, e = Network.multiplex()
    for sock in r:
        try:
            sock.handleInput()
        except Exception, exc:
            print "Unhandled exception:", exc
Example #3
0
def update():
	getDesktop().draw()
	getDesktop().update()
	
	r, w, e = Network.multiplex()
	for sock in r:
		try:
			sock.handleInput()
		except Exception, exc:
			print "Unhandled exception:", exc
Example #4
0
def run():
    while running:
        r, w, e = Network.multiplex(1)
        for sock in r:
            try:
                sock.handleInput()
            except Exception, exc:
                if (exc.__class__ != 'socket.error'):
                    print "Unhandled exception:", exc
        for sock in w:
            sock.handleOutput()
        for sock in e:
            sock.close()
Example #5
0
def run():
    while running:
        r, w, e = Network.multiplex(1)
        for sock in r:
            try:
                sock.handleInput()
            except Exception, exc:
                if exc.__class__ != "socket.error":
                    print "Unhandled exception:", exc
        for sock in w:
            sock.handleOutput()
        for sock in e:
            sock.close()