コード例 #1
0
ファイル: sponsor.py プロジェクト: jimmylowell/pyspeed
 def __init__(self, sponsor_string, first_test_date, username, password):
     self.sponsor_string = sponsor_string
     self.first_test_date = first_test_date
     self.username = username
     self.password = password
     self.simple_name = self.getSimpleNameFromEmail()
     self.servers = [
         Server(self.sponsor_string, server_id)
         for server_id in self.getServerIDs()
     ]
     logger = logging.getLogger("pyspeed.SpeedtestSponsor.init")
     logger.info("sponsor instantiated")
コード例 #2
0
ファイル: thread_handler.py プロジェクト: badcode6/wenet
def spool_up(doJoin):
    if doJoin:
        connectTo = input("Enter address (address:port): ")        
        if connectTo == "":
            connectTo = "2.tcp.ngrok.io:14583"
        host = connectTo.split(":")[0]
        port = connectTo.split(":")[1]
        print(host)
        print(port)
        myclient = Client(host, int(port))#change to whatever ngrok tunnels to
        client = threading.Thread(target=myclient.start, args=())
        client.start()
        client.join()
    myserver = Server("localhost", 8000)
    server = threading.Thread(target=myserver.start, args=())
    server.start()
    server.join()
コード例 #3
0
from select import select
from sys import exit, argv
from socket import socket, AF_INET, SOCK_STREAM
from modules.server import Server
from modules.aescipher import AESCipher
from modules.utils import notify
from modules.keystore import KeyStore
from modules.gfx import Gfx
from conf import gfx
from time import sleep
import threading

server_address = ("0.0.0.0", 9000)
if len(argv) == 3:
    server_address = (argv[1], int(argv[2]))
serv = Server(server_address)

def handle_sockets(readable, writable, exceptional, serv):
    stop = serv.handle_readable(readable)
    serv.handle_writable(writable)
    return stop, serv.inputs, serv.outputs

def start_server():
    stop = False
    notify("AESchat Server Running on port %s:%i" %(server_address))
    while stop is not True:
        readable, writable, exceptional = select(serv.inputs, serv.outputs, serv.inputs)
        stop, serv.inputs, serv.outputs = handle_sockets(readable, writable, exceptional, serv)
    print("\nGoodbye")
    serv.socket.close()
    return 0
コード例 #4
0
def run_server():
    server = Server(conf)
    asyncio.run(server.start())
コード例 #5
0
ファイル: main.py プロジェクト: deliveree/psql-monitor-daemon
from modules.utils import load_conf
from modules.server import Server

parser = argparse.ArgumentParser()
parser.add_argument("--loglevel",
                    "-l",
                    type=str,
                    default="ERROR",
                    help="The log level (default: ERROR)")
parser.add_argument("--logfile",
                    "-f",
                    type=str,
                    help="The path to logfile (default: None)")

if __name__ == "__main__":
    args = parser.parse_args()
    loglevel = args.loglevel
    logfile = args.logfile

    logging.basicConfig(filename=logfile,
                        level=loglevel,
                        format="%(asctime)s - %(message)s")

    conf = load_conf()
    server = Server(conf)

    try:
        asyncio.run(server.start())
    except KeyboardInterrupt:
        logging.info("Server is shut down by KeyboardInterrupt")
コード例 #6
0
ファイル: server.py プロジェクト: soumadip/VO_P2P
import sys

from modules.server import Server
from modules.client import Client

if __name__ == "__main__":
    HOST = sys.argv[2] if len(sys.argv) == 3 else "localhost"
    if sys.argv[1] == 's':
        Server(local_host=HOST)
    elif sys.argv[1] == 'c':
        Client(remote_host=HOST)
    else:
        print("Provide CLA")
コード例 #7
0
    def __init__(self):
        super().__init__('main.log', 'main.pid', 'config.yml')

        server = Server(self.config['servconf'], self.config['dbconf'],
                        self.config['uniconf'], self.config['goipconf'])
        server.start()