File tree Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Expand file tree Collapse file tree 3 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -3,16 +3,16 @@ open Fd_send_recv
33
44let t_receivefd fd =
55 Printf. printf " [receiver] t_receivedfd thread started!\n %!" ;
6- let buf = " **" in
6+ let buf = Bytes. of_string " **" in
77 let nb_read, remote_saddr, fd_recv = recv_fd fd buf 0 2 [] in
88 Printf. printf " [receiver] Received %d bytes, received fd = %d\n %!" nb_read (int_of_fd fd_recv);
99 let message = " [receiver] I'm the receiver, and I'm writing into the fd you passed to me :p\n " in
10- let nb_written = write fd_recv message 0 (String. length message) in
10+ let nb_written = write fd_recv ( Bytes. unsafe_of_string message) 0 (String. length message) in
1111 assert (nb_written = String. length message)
1212
1313let t_sendfd fd =
1414 let fd_to_send = stdout in
15- let buf = " " in
15+ let buf = Bytes. of_string " " in
1616 let nb_sent = send_fd fd buf 0 2 [] fd_to_send in
1717 Printf. printf " [sender] sent %d bytes, sent fd = %d\n %!" nb_sent (int_of_fd fd_to_send)
1818
Original file line number Diff line number Diff line change @@ -3,16 +3,16 @@ open Fd_send_recv
33
44let t_receivefd fd =
55 Printf. printf " [receiver] t_receivedfd thread started!\n %!" ;
6- let buf = " **" in
6+ let buf = Bytes. of_string " **" in
77 let nb_read, remote_saddr, fd_recv = recv_fd fd buf 0 2 [] in
88 Printf. printf " [receiver] Received %d bytes, received fd = %d\n %!" nb_read (int_of_fd fd_recv);
99 let message = " [receiver] I'm the receiver, and I'm writing into the fd you passed to me :p\n " in
10- let nb_written = write fd_recv message 0 (String. length message) in
10+ let nb_written = write fd_recv ( Bytes. unsafe_of_string message) 0 (String. length message) in
1111 assert (nb_written = String. length message)
1212
1313let t_sendfd fd =
1414 let fd_to_send = stdout in
15- let buf = " " in
15+ let buf = Bytes. of_string " " in
1616 let nb_sent = send_fd fd buf 0 2 [] fd_to_send in
1717 Printf. printf " [sender] sent %d bytes, sent fd = %d\n %!" nb_sent (int_of_fd fd_to_send)
1818
Original file line number Diff line number Diff line change @@ -3,14 +3,14 @@ open Fd_send_recv
33
44let t_receivefd fd =
55 Printf. printf " [receiver] t_receivedfd thread started!\n %!" ;
6- let buf = String . make (Tuntap. get_ifnamsiz () ) '\000' in
7- let nb_read, remote_saddr, fd_recv = recv_fd fd buf 0 (String . length buf) [] in
6+ let buf = Bytes . make (Tuntap. get_ifnamsiz () ) '\000' in
7+ let nb_read, remote_saddr, fd_recv = recv_fd fd buf 0 (Bytes . length buf) [] in
88 Printf. printf " [receiver] Received %d bytes [%s], received fd = %d\n %!"
9- nb_read (String. sub buf 0 nb_read) (int_of_fd fd_recv)
9+ nb_read (Bytes. sub_string buf 0 nb_read) (int_of_fd fd_recv)
1010
1111let t_sendfd fd =
1212 let fd_to_send, iface_name = Tuntap. opentap () in
13- let nb_sent = send_fd fd iface_name 0 (String. length iface_name) [] fd_to_send in
13+ let nb_sent = send_fd fd ( Bytes. unsafe_of_string iface_name) 0 (String. length iface_name) [] fd_to_send in
1414 Printf. printf " [sender] sent %d bytes [%s], sent fd = %d\n %!" nb_sent
1515 (String. sub iface_name 0 nb_sent) (int_of_fd fd_to_send)
1616
You can’t perform that action at this time.
0 commit comments