Пример #1
0
# basic stuff
socketmodule = flame.module("socket")
osmodule = flame.module("os")
print("remote host name=", socketmodule.gethostname())
print("remote server current directory=", osmodule.getcwd())
flame.execute("import math")
root = flame.evaluate("math.sqrt(500)")
print("calculated square root=", root)
try:
    print("remote exceptions also work...", flame.evaluate("1//0"))
except ZeroDivisionError:
    print("(caught ZeroDivisionError)")

# print something to the remote server output
flame.builtin("print")("Hello there, remote server stdout!")

# upload a module source and call a function, on the server, in this new module
modulesource = open("stuff.py").read()
flame.sendmodule("flameexample.stuff", modulesource)
result = flame.module("flameexample.stuff").doSomething("hello", 42)
print("\nresult from uploaded module:", result)

# remote console
with flame.console() as console:
    print("\nStarting a remote console. Enter some commands to execute remotely. End the console as usual.")
    console.interact()
    print("Console session ended.")


Пример #2
0
# basic stuff
socketmodule = flame.module("socket")
osmodule = flame.module("os")
print("remote host name=", socketmodule.gethostname())
print("remote server current directory=", osmodule.getcwd())
flame.execute("import math")
root = flame.evaluate("math.sqrt(500)")
print("calculated square root=", root)
try:
    print("remote exceptions also work...", flame.evaluate("1//0"))
except ZeroDivisionError:
    print("(caught ZeroDivisionError)")

# print something to the remote server output
flame.builtin("print")("Hello there, remote server stdout!")

# upload a module source and call a function, on the server, in this new module
modulesource = open("stuff.py").read()
flame.sendmodule("flameexample.stuff", modulesource)
result = flame.module("flameexample.stuff").doSomething("hello", 42)
print("\nresult from uploaded module:", result)

# remote console
with flame.console() as console:
    print(
        "\nStarting a remote console. Enter some commands to execute remotely. End the console as usual."
    )
    console.interact()
    print("Console session ended.")
Пример #3
0
    # location = input("what is the location of the flame server, hostname:portnumber? ")
    location = "localhost:43863"
    print()

    # connect!
    flame = Pyro4.utils.flame.connect(location)

    # basic stuff
    socketmodule = flame.module("socket")
    osmodule = flame.module("os")
    print("remote host name=", socketmodule.gethostname())
    print("remote server current directory=", osmodule.getcwd())

    file = Rmi()
    # Informacje na serwerze gdy polaczy sie z klientem
    flame.builtin("print")("Serwer polaczyl sie z klientem")

    while True:
        main()
        a = input("Czy chciałbyś jeszcze skorzystać z któreś usługi? (y/n)")
        if a == 'y':
            main()
        elif a != 'y' and a != 'n':
            print("Wybrano niewłaściwy klawisz")
            a = input(
                "Czy chciałbyś jeszcze skorzystać z któreś usługi? (y/n)")

        if a == "n":
            print("Dziękujemy za skorzystanie z naszych usług. Do zoboczenia!")
            sys.exit(0)