Esempio n. 1
0
    def __init__(self, ip, port):
        self._server = Server((ip, port), allow_none=True)
        self._server.register_function(self.get, 'get')
        self._server.register_function(lambda: 'OK', 'ping')

        self._ros_service_proxy = rospy.ServiceProxy('ed/query', Query)

        self._sp = xmlrpclib.ServerProxy("http://%s:%d" % (ip, port))
        self._stop = False
    def __init__(self, ip, port, robot_name):
        self._server = Server((ip, port), allow_none=True)
        self._server.register_function(self.get, 'get')
        self._server.register_function(lambda: 'OK', 'ping')
        self._sp = ServerProxy("http://%s:%d" % (ip, port))

        self._ros_publisher = rospy.Publisher('/%s/trigger' % robot_name,
                                              String,
                                              queue_size=10)

        self._stop = False
Esempio n. 3
0
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer as Server


class Operators:
    def add(self, a, b):
        return a + b

    def mult(self, a, b):
        return a * b

    def div(self, a, b):
        return a / b


port = 8080
server = Server(('localhost', port))
print('Listening on port ', port)
server.register_instance(Operators())
server.serve_forever()
Esempio n. 4
0
from sikuli.Sikuli import *
#
import subprocess, sys, os, os.path, shutil, ntpath, re
from SimpleXMLRPCServer import SimpleXMLRPCServer as Server
srv = Server(("127.0.0.1", 1337),allow_none=True) # as an example on the same machine
if not srv: exit(1)
#
setAutoWaitTimeout(300)
'''
    20150130
    Moved to git and removed locally significat versioning
  
    This script is run after AS2StackWalk.py
    Recreated for Pro on 20120509
     Updated to chunk into defs

	20120928
	Started from scratch re-writing Astro caps
	This file loads previously saved pickle cap data

        20121014
    Adding full raw and sharp support, save as new

    Major rework 20121105 - Exceptions, load dict from os.listdir for real caps

    Updated 20130620 - Added os.list dir instead of dict and new defs to pull out time from file

    Reworked 20130709 to use XML RPC and only leave custom Def's behind, rest is done via python calls

Updated pathing for NewDocDirs2 20130418
'''
Esempio n. 5
0
print 'pid:', str(os.getpid())
with file(PID_FILE, 'w') as f:
    f.write(str(os.getpid()))

import actions


def action(action_name, name, *args):
    if actions.set_info.no_info:
        return False, 'no_info'
    try:
        print(action_name, name, args)
        if (action_name == 'exist'):
            return True, actions.exist(name)
        proc = getattr(actions, action_name)
        return True, actions.action(proc, name, args)
    except:
        print str(sys.exc_info()[1])
        return False, str(sys.exc_info()[1])


def alive():
    return True


server = Server(('127.0.0.1', 1337))
server.register_function(action)
server.register_function(actions.set_info)
server.register_function(alive)
server.serve_forever()
Esempio n. 6
0
from SimpleXMLRPCServer import SimpleXMLRPCServer as Server
import xmlrpclib


# recibe el archivo de texto
def receive_data(file_name):
    with open(file_name, "rb") as handle:
        return xmlrpclib.Binary(handle.read())


def get_file(file_name):
    file = open(file_name, 'r')
    data = []
    for item in file:
        data.append(int(item.rstrip()))
    file.close()
    return data


port = 8000
server = Server(("localhost", port))
print("Listening on port ", port)
server.register_function(receive_data)
a = get_file("clientdata.txt")  # pasa datos de archivo a una variable
print("receive: ", a)

server.serve_forever()
Esempio n. 7
0
import xmlrpclib
from SimpleXMLRPCServer import SimpleXMLRPCServer as Server


def add(a, b):
    return a + b


port = 8080
connection = Server(('localhost', port))
print('Listening on port ', port)
connection.register_function(add)
connection.serve_forever()

class Handler(SimpleXMLRPCRequestHandler):

    rpc_paths = ('/xmlrpc/')


def fak(n):
    """ Berechnet die Fakultaet der ganzen Zahl n. """
    erg = 1
    for i in xrange(2, n + 1):
        erg *= i
    return erg


def quad(n):
    """ Berechnet das Quadrat der Zahl n. """
    return n * n


def ping(msg):
    """Simply returns the args passed to it as a string"""
    return str(msg)


srv = Server(("localhost", location), requestHandler=Handler)
srv.register_introspection_functions()
srv.register_function(fak)
srv.register_function(quad)
srv.register_function(ping)
srv.serve_forever()
Esempio n. 9
0
    #def receive_data(self,nom_arch):
    #with open(nom_arch, "rb") as handle:
    #return xmlrpclib.Binary(handle.read())
    def server_receive_file(self, arg):
        with open(
                "C:\Users\Estudiantes\Downloads\Funcionando localhost\Datos_Recibidos_Cliente.txt",
                "wb") as handle:
            handle.write(arg.data)
            return True

    def calcular_datos(self, nom_arch):
        file = open(nom_arch, 'r')
        li = []
        for num in file:
            f = factorial(int(num))
            li.append(f)
        file.close
        crear_archivo(li)
        return li

    #def llamado_calcular(self):
    #r=calcular_datos("Respuesta_servidor_Datos_lista.txt")
    #return r


conexion = Server(("192.168.9.82", 8000))
print "###################servidor ONLINE #####################################"
print "Soy el servidor y estoy escuchando por el puerto:" + str(8000)
conexion.register_instance(Operaciones())
conexion.serve_forever()