Example #1
0
def main(expresion):
    transport = TSocket.TSocket("localhost", 9090)
    transport = TTransport.TBufferedTransport(transport)
    protocol = TBinaryProtocol.TBinaryProtocol(transport)

    client = Calculadora.Client(protocol)

    transport.open()

    print("hacemos ping al server")
    client.ping()

    hay_error = procesa_expresion(expresion, client)

    transport.close()

    return hay_error
Example #2
0
from calculadora import Calculadora

from calculadora.ttypes import funcion

from thrift import Thrift
from thrift.transport import TSocket
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol

transport = TSocket.TSocket('localhost', 9090)
transport = TTransport.TBufferedTransport(transport)
protocol = TBinaryProtocol.TBinaryProtocol(transport)
#creamos el cliente
client = Calculadora.Client(protocol)


def mostrarVector(resultado):
    salida = "Vector: [ "
    for i in range(0, len(resultado)):
        salida = salida + " " + str(resultado[i]) + " "
    salida = salida + " ]"
    print(salida)


def mostrarFuncion(f1):
    salida = "Funcion: " + str(f1.x) + "x^" + str(
        f1.exponente_x) + " + " + str(f1.y) + "x^" + str(
            f1.exponente_y) + " + " + str(f1.z) + "x^" + str(f1.exponente_z)
    print(salida)