Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,11 @@
open Unix
let init_socket addr port =
let inet_addr = (gethostbyname addr).h_addr_list.(0) in
let sockaddr = ADDR_INET (inet_addr, port) in
let sock = socket PF_INET SOCK_STREAM 0 in
connect sock sockaddr;
(* convert the file descriptor into high-level channels: *)
let outchan = out_channel_of_descr sock in
let inchan = in_channel_of_descr sock in
(inchan, outchan)

View file

@ -0,0 +1,4 @@
let () =
let ic, oc = init_socket "localhost" 256 in
output_string oc "hello socket world";
;;