Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mcp/blob/main/data/examples/sockets.om # omega-mcp aien-dev/omega-mcp Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mcp / data / examples / sockets.om` 37 lines ยท 801 bytes Raw Blame History 1 note a Unix socket pair in the working directory: socket, option, bind, listen, connect, accept, 2 note send, wait, receive, peer identity, sendmsg, poll and shutdown 3 global buf uchar 64 4 global four uchar 4 5 global pfd uchar 8 6 text msg "ping" 7 fn ck yes bool to void 8 if not yes 9 exit 80 10 end 11 end 12 fn main to int 13 na = new uchar 3 0 14 put na 0 1 15 put na 2 115 16 s = int socknew 1 1 0 17 ck ge s 0 18 put four 0 1 19 ck eq sockopt s 1 2 four 0 4 0 20 ck eq bind s na 0 3 0 21 ck eq listen s 4 0 22 ck gt sockname s buf 0 64 0 23 c = int socknew 1 1 0 24 ck eq connect c na 0 3 0 25 a = int accept s 0 26 ck ge a 0 27 ck eq send c msg 0 4 0 4 28 ck gt waitio a 1 `1000000000` 0 29 ck eq recv a buf 0 4 0 4 30 ck eq peercred a buf 0 12 0 31 ck eq sendmsg a msg 0 4 0 4 32 put pfd 0 uchar c 33 put pfd 4 1 34 ck eq pollfds pfd 0 8 `1000000000` 1 35 ck eq shutdown c 2 0 36 ret 0 37 end