code wiki / (root) / nx_net_chan_test.nx

nx_net_chan_test.nx

buildroot/runtime/nx_net_chan_test.nx

4834 B140 linesdepth 6pulls 13 transitivereach 0 importersview sourcekind gate/prooftopic net
docsdependenciesstructsconstsfunctions

about

nx_net_chan_test.nx -- prove typed i64 channel works over TCP loopback with multi-message exchange. Server thread: accept connection, recv N messages, verify they equal 0..N-1, send back doubled value. Client thread: connect, send 0..N-1, recv N doubled values, verify each == 2*i. This is the distributed-MIMD building block: nx_net_chan_send / recv is the same shape as nx_chan_send / recv, so existing pipeline / pool / DAG code can use net_chan wherever they use chan, transparently distributing across hosts when run on a cluster.

dependencies 6 imports · 0 importers

nx_kernel_v2.nx nx_log.nx nx_atom.nx nx_thread.nx nx_socket.nx nx_net_chan.nx nx_net_chan_test.nx

imports: nx_kernel_v2.nxnx_log.nxnx_atom.nxnx_thread.nxnx_socket.nxnx_net_chan.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_net_chan_recv sys_mmap ↻ _nx_net_unpack_be64 nx_net_chan_send sys_mmap ↻ _nx_net_pack_be64 nx_net_chan_close nx_sock_shutdown sys_close nx_atom_load_i64 nx_thread_yield

structs

24struct NetTestState

consts

21const NX_PORT: i64 = 38919
22const N_MSGS: i64 = 100

functions

29func _sleep_ms(ms: i64) -> i64
called by 1: client_main
38func client_main(arg: *u8) -> i64
79func main() -> nx_exit