Re: [python-tulip] help deal with aiomas rpc

2018-02-19 Thread Stefan Scherfke
The protocol aiomas uses is described here:

https://aiomas.readthedocs.io/en/latest/guides/channel.html?highlight=endian#how-exactly-do-messages-look-like


> Am 2018-02-19 um 14:31 schrieb velopoka...@gmail.com:
> 
> good afternoon.
> I can not understand how to call the rpc method via the pure tcp
> 
> This simple server:
> 
> import aiomas
> 
> class Server:
> router = aiomas.rpc.Service()
> 
> @aiomas.expose
> def ping(self, i):
> print('Ping receive data: {}'.format(i))
> return i
> 
> 
> if __name__ == '__main__':
> server = aiomas.run(aiomas.rpc.start_server(
> ('127.0.0.1', 5000),
> Server())
> )
> print('Server run')
> aiomas.run(server.wait_closed())
> 
> 
> And this my problem tcp client
> 
> import socket
> import pickle
> 
> 
> MESS = ['ping', [1]]
> 
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.connect(('127.0.0.1', 5000))
> s.settimeout(1.5)
> s.send(pickle.dumps(MESS))
> data = s.recv(1024)
> s.close()
> 
> 
> Tell me please what's wrong. It is necessary to understand in order to 
> realize this in other languages.Much grateful for any hint
> 



[python-tulip] help deal with aiomas rpc

2018-02-19 Thread velopokatun
good afternoon.
I can not understand how to call the rpc method via the pure tcp

This simple server:

import aiomas

class Server:
router = aiomas.rpc.Service()

@aiomas.expose
def ping(self, i):
print('Ping receive data: {}'.format(i))
return i


if __name__ == '__main__':
server = aiomas.run(aiomas.rpc.start_server(
('127.0.0.1', 5000),
Server())
)
print('Server run')
aiomas.run(server.wait_closed())



And this my problem tcp client

import socket
import pickle


MESS = ['ping', [1]]

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('127.0.0.1', 5000))
s.settimeout(1.5)
s.send(pickle.dumps(MESS))
data = s.recv(1024)
s.close()



Tell me please what's wrong. It is necessary to understand in order to 
realize this in other languages.Much grateful for any hint