Easy way to talk to hashserv or prserv?
Hi Joshua and all,
I'm going to test changes to the prserv server, to implement "passthrough" to another server.
I can make tests by checking the impact of my changes on the build results, like checking the revision of generated packages. However, would there be an easy way to make a test connection to a server based on the bb.asyncrpc.AsyncServer class, such as hashserv or prserv?
Feeling lucky, I tried with a plain "telnet":
telnet 0.0.0.0 8585
Trying 0.0.0.0...
Connected to 0.0.0.0.
Escape character is '^]'.
get-pr ethtool-6.7-r0
Connection closed by foreign host.
The request doesn't look that bad, as the server doesn't complain (in the logs) but I don't get the return value.
So, any tip for talking to a server from a terminal, or do I need a proper client written in Python? Cheers
Michael.
Signature · 3 lines
Michael Opdenacker, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Quoted 20 lines · Michael Opdenacker
Hi Joshua and all,
I'm going to test changes to the prserv server, to implement "passthrough" to another server.
I can make tests by checking the impact of my changes on the build results, like checking the revision of generated packages. However, would there be an easy way to make a test connection to a server based on the bb.asyncrpc.AsyncServer class, such as hashserv or prserv?
Feeling lucky, I tried with a plain "telnet":
telnet 0.0.0.0 8585
Trying 0.0.0.0...
Connected to 0.0.0.0.
Escape character is '^]'.
get-pr ethtool-6.7-r0
Connection closed by foreign host.
Quoted 5 lines
The request doesn't look that bad, as the server doesn't complain (in the logs) but I don't get the return value.
So, any tip for talking to a server from a terminal, or do I need a proper client written in Python?
The protocol is all a line based-text protocol (at least for the TCP & UNIX domain sockets; websockets are another story); the basic flow is (C for client, S for Server)
1. C: <greeting and protocol version>
2. C: <0 or more lines of headers>
3. C: <empty line>
4. C: <Line of JSON encoding message>
5. S: <Line of JSON responding to message>
Each line is terminated with a single newline
In the (near) future, the Server will send headers back to the client between lines 3 and 4, but that's not implemented yet
While you _could_ possibly manually do this using netcat (and maybe telnet? Not sure if telnet option negotiation would mess that up), it's going to be tricky to get right, so I'd recommend a python client. Also, if you want websockets I wouldn't try to do that without a client as that protocol is a lot more complicated
Quoted 10 lines
Cheers
Michael.--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com