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-mv/blob/main/seed/host/tests/sockopt.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / host / tests / sockopt.om` 58 lines ยท 1009 bytes Raw Blame History 1 note Verify socket option effect with an independent bind outcome on an ephemeral loopback UDP port. 2 global addr uchar 16 3 text enabled "abcd" 4 fn setreuse fd int option view uchar 8 to long 5 ret add long 9 sockopt fd 1 2 option 2 4 6 end 7 fn main to int 8 option = new uchar 8 0 9 put option 2 1 10 put addr 0 2 11 put addr 4 127 12 put addr 7 1 13 a = socknew 2 2 0 14 if lt a 0 15 ret 1 16 end 17 b = socknew 2 2 0 18 if lt b 0 19 ret 2 20 end 21 if ne setreuse int a option 9 22 ret 3 23 end 24 if ne bind int a addr 0 len addr 0 25 ret 4 26 end 27 if ne sockname int a addr 0 len addr 16 28 ret 5 29 end 30 if and eq get addr 2 0 eq get addr 3 0 31 ret 6 32 end 33 if ne bind int b addr 0 len addr neg long 98 34 ret 7 35 end 36 if ne sockopt int b 1 2 enabled 0 len enabled 0 37 ret 8 38 end 39 if ne bind int b addr 0 len addr 0 40 ret 9 41 end 42 if ne sockopt neg int 1 1 2 enabled 0 4 neg long 9 43 ret 10 44 end 45 if ne sockopt int b 1 2 enabled 0 0 neg long 22 46 ret 11 47 end 48 if ne sockopt int b 1 `2147483647` enabled 0 4 neg long 92 49 ret 12 50 end 51 if ne fclose int a 0 52 ret 13 53 end 54 if ne fclose int b 0 55 ret 14 56 end 57 ret 0 58 end