Example #1
0
def handle_json(filename):
    global config
    f = open(filename)
    config = json.load(f)
    f.close()
    SS.ServerIP = SS.getIP(interface=config["LAN_Interface"])
    SS.CameraPort = config["CameraPort"]
    SS.ServerPort = config["ControllerPort"]
Example #2
0
 def startHosting(self, instance):
     self.getInputStartup()
     WIApp.serverSocket = ServerSocket(WIApp.ip, WIApp.port)
     WIApp.serverSocket.start()
     self.popup.dismiss()
     self.login()
Example #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from mininet.topo import *
from mininet.net import Mininet
import pickle
import socket
import logging
from logging.handlers import DEFAULT_TCP_LOGGING_PORT
import ServerSocket
import threading
from time import sleep

logging.basicConfig(level=logging.DEBUG, format='%(levelname)s - %(message)s')
ServerSocket.set_name_operator('Client')
"""           
class StreamRequestMininet(ServerSocket.ServerSocket.StreamRequestHandler):
    def handle(self):
        logger = self.connection.recv(1024)
        msg = logger.decode('ascii')
        print msg
"""


class ClientNetwork(threading.Thread):
    """
    Classe que controla o envio de comandos para o servidor. A solicitacao de conexΓ£o do cliente inicia a rede virtual no Servidor
    """
    _shutdown = False

    def __init__(self):
        super(ClientNetwork, self).__init__()
#!/usr/bin/python
from ServerSocket import *
import sys,os,time
if __name__ == "__main__":
	Server = ServerSocket()
	Server.daemon = True
	Server.start()
	while True:
		try:
			print "Programa General"
			time.sleep(1)
		except KeyboardInterrupt:
			sys.exit()
        
        
    
    
Example #5
0
__author__ = 'SKings'
from ServerSocket import *

server = ServerSocket("127.0.0.1",7777,"saman")
server.startServer()
exit = input("write exit to exit : ")
while exit != "exit":
    print(exit)
    exit = input("write exit to exit : ")

server.kill_server()
Example #6
0
    config = json.load(f)
    f.close()
    SS.ServerIP = SS.getIP(interface=config["LAN_Interface"])
    SS.CameraPort = config["CameraPort"]
    SS.ServerPort = config["ControllerPort"]


if __name__ == "__main__":
    handle_json('config.json')
    print(sys.argv)
    # with open("pids.txt", "w") as file1:
    #     L = ["bash pid: " + str(sys.argv[-1]), "\npyth pid: " + str(os.getpid())]
    #     file1.writelines(L)
    print("starting at", SS.ServerIP, "on port", SS.ServerPort, "pid: ", os.getpid())
    connection = None
    sock = SS.startSocket()
    sock.listen(1)
    sockState = SS.possibleStates[0]
    frState = {"r": 0.0, "f": 0.0}
    try:
        car = GP.Car(config["GPIO_pinAssignment"]["BackMotor1"], config["GPIO_pinAssignment"]["BackMotor2"], config["GPIO_pinAssignment"]["FrontServoSignalPin"], config["GPIO_pinAssignment"]["FrontServoReverser"], config["GPIO_pinAssignment"]["ThrottleMaxAfter"])
        if config["CameraOn"]:
            # camera = VF.startCam(height=config["CameraSetup"]["height"], width=config["CameraSetup"]["width"], frameRate=config["CameraSetup"]["framerate"], rotation=config["CameraSetup"]["rotation"])
            # cameraServer = VF.StreamingServer((SS.ServerIP, SS.CameraPort), VF.StreamingHandler)
            # p = threading.Thread(target=cameraServer.serve_forever)
            camAddress = (SS.ServerIP, SS.CameraPort)
            h = config["CameraSetup"]["height"]
            w = config["CameraSetup"]["width"]
            framerateeeee = config["CameraSetup"]["framerate"]
            rot = config["CameraSetup"]["rotation"]
            p = multiprocessing.Process(target=VF.start, args=(camAddress, h, w, framerateeeee, rot, ))