Ejemplo n.º 1
0
def dataserver():
    """ DataServe thread function. Sets up a socket server
        which will respond to incoming data requests
    """
    # start
    commsocket.server(dataserver_responder,
                      int(config['ports']['flask_insense']))
Ejemplo n.º 2
0
def enqueue():
    """ Enqueue thread function. Sets up a socket server
        which will put incoming messages on the queue.
    """
    # start 
    print('Starting Enqueue Server:')
    commsocket.server(enqueue_responder, int(config['ports']['flask_output']) )
Ejemplo n.º 3
0
def logger():
    """ Thread which sets up the logging then starts a
        socket server which logs incoming messages.
    """
    # Set up logging
    logging.basicConfig(level=logging.INFO)
    # Set up logfile - make file handler, formatter and add logger
    logfile = config['output']['logfile']
    fhand = logging.FileHandler(logfile)
    fmt = "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
    fhand.setFormatter(logging.Formatter(fmt))
    logging.getLogger().addHandler(fhand)
    # Listen for logging events on logport
    commsocket.server(log_responder, logport)
Ejemplo n.º 4
0
    
    Usage: python outputsim.py configfile.txt

'''

# Look for parameters
import sys
if len(sys.argv) < 2:
    print("usage: python insensim.py path/to/config_file.ini")
    exit(1)
# Get config file
import configparser
config = configparser.ConfigParser()
config.read(sys.argv[1])
# Set path if needed
try:
    sys.path.append(config['paths']['pythonpath'])
except:
    pass

# Imports 
import socket
from bparts import commsocket

# Settings
flask_port = int(config['ports']['flask_insense'])

# Run server with testresponse_noanswer function
commsocket.server(commsocket.testresponse_withanswer, flask_port)
print("InsenseSim - quit")
Ejemplo n.º 5
0
def commsocket_funct():
    print 'Starting Commsocket'
    commsocket.server(take_color, flask_port)
Ejemplo n.º 6
0
import socket
from bparts import commsocket
from time import sleep
import shutil
import threading

# Globals
flask_port = 50747
cmd = ''
message = ' '


def resp_funct(message):
    print message
    return message


commsocket.server(resp_funct, flask_port)