Exemplo n.º 1
0
def converse(me, s, port, respond):
    log.lock("", port)
    s.listen(port)
    log.log(me, "listening for client on %s"%(port))
    conn, addr = s.accept()
    log.lock("%s locked by %s"%(port, conn), port)
    log.log(me, "contacted by %s"%(addr,))
    rcvd = conn.recv(1024)
    conn.sendall(respond(rcvd))
    conn.close()
    log.lock("", port)
    log.log(me, "done")
Exemplo n.º 2
0
#!/usr/bin/env python

import auth, notification, wlan
from log import log, lock

import sys, threading

NO_UI = False

if not NO_UI:
    import ui
    tb = ui.init()
    
if not lock():
    if NO_UI:
        # This is important enough to print to the screen. 
        print "Error: could not obtain lockfile, quitting"
    else:
        tb.notice("Another instance of Airbears Supplicant is already running.")
    sys.exit(-1)
else:
    log("Lockfile acquired")
    
log("Started AirBears supplicant")
log("NO_UI = " + str(NO_UI))
if not NO_UI:
    tb.notice("Welcome to AirBears Supplicant")

def connection_callback():
    log("Received connection notification")
    if wlan.has_airbears():
Exemplo n.º 3
0
#!/usr/bin/env python

import auth, notification, wlan
from log import log, lock

import sys, threading

NO_UI = False

if not NO_UI:
    import ui
    tb = ui.init()

if not lock():
    if NO_UI:
        # This is important enough to print to the screen.
        print "Error: could not obtain lockfile, quitting"
    else:
        tb.notice(
            "Another instance of Airbears Supplicant is already running.")
    sys.exit(-1)
else:
    log("Lockfile acquired")

log("Started AirBears supplicant")
log("NO_UI = " + str(NO_UI))
if not NO_UI:
    tb.notice("Welcome to AirBears Supplicant")


def connection_callback():