コード例 #1
0
 def __init__(self, recipes_database_file, profiles_database_file):
     self.DBManager = DataBaseManager(recipes_database_file,
                                      profiles_database_file)
コード例 #2
0
ファイル: server.py プロジェクト: ShacharMeir007/ResQ
import socket
import select
import json
from Request import *
from RequestDecoder import *
import image_server
from DataBaseManager import *
"""
this is the server.
the server receive request from client send to database and return to client the response.
the server receive data from hospitals and upload to data base.
"""

codes = []

database = DataBaseManager()


def main():
    server_socket = socket.socket()
    server_socket.bind(('0.0.0.0', 1802))
    server_socket.listen()
    open_client_sockets = []
    messages_to_send = []
    while True:
        rlist, wlist, xlist = select.select(
            [server_socket] + open_client_sockets,
            [mes[0] for mes in messages_to_send], [])
        for current_socket in rlist:
            if current_socket is server_socket:
                # new client