code wiki / (root) / nx_rpc_test.nx

nx_rpc_test.nx

buildroot/runtime/nx_rpc_test.nx

6198 B162 linesdepth 6pulls 14 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_rpc_test.nx -- end-to-end typed RPC over loopback. Server registers 2 method handlers: method 1 (echo): copy request -> response unchanged method 2 (length): respond with the request length as 8-byte i64 Client makes 3 calls (echo "ping" + echo "hello world" + length "this is a longer message" -> 24), verifies each response, then sends shutdown sentinel.

dependencies 7 imports · 0 importers

nx_kernel_v2.nx nx_log.nx nx_atom.nx nx_thread.nx nx_socket.nx nx_net_chan.nx nx_rpc.nx nx_rpc_test.nx

imports: nx_kernel_v2.nxnx_log.nxnx_atom.nxnx_thread.nxnx_socket.nxnx_net_chan.nxnx_rpc.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_sock_socket nx_sock_reuseaddr nx_sock_setsockopt nx_sock_sin_init nx_sock_htons nx_sock_bind nx_sock_listen nx_thread_spawn_fn sys_mmap nx_sock_accept nx_net_chan_from_fd sys_mmap ↻ nx_rpc_server_new sys_mmap ↻ nx_rpc_register _nx_rpc_handler_at nx_rpc_server_run sys_mmap ↻ nx_net_chan_recv sys_mmap ↻ _nx_net_unpack_be64 nx_atom_store_i64 nx_net_chan_recv_blob sys_mmap ↻ _nx_net_read_n _nx_net_unpack_be64 ↻ _nx_rpc_handler_at ↻ nx_net_chan_send_blob sys_mmap ↻ _nx_net_pack_be64 _nx_net_write_n nx_atom_faa_i64 nx_net_chan_close nx_sock_shutdown sys_close nx_atom_load_i64 nx_thread_yield

structs

21struct RpcTestState

consts

19const NX_PORT: i64 = 38927

functions

26func _sleep_ms(ms: i64) -> i64
called by 1: rpc_client
35func handler_echo(req: *u8, req_n: i64, resp: *u8, max_resp: i64) -> i64
43func handler_length(req: *u8, req_n: i64, resp: *u8, max_resp: i64) -> i64
58func rpc_client(arg: *u8) -> i64
110func main() -> nx_exit