1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link rel="previous" href="Neturl_tut.html">
<link rel="next" href="Netsys_posix.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of extensions" rel=Appendix href="index_extensions.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of class attributes" rel=Appendix href="index_attributes.html">
<link title="Index of class methods" rel=Appendix href="index_methods.html">
<link title="Index of classes" rel=Appendix href="index_classes.html">
<link title="Index of class types" rel=Appendix href="index_class_types.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Uq_gtk" rel="Chapter" href="Uq_gtk.html">
<link title="Uq_tcl" rel="Chapter" href="Uq_tcl.html">
<link title="Equeue" rel="Chapter" href="Equeue.html">
<link title="Unixqueue" rel="Chapter" href="Unixqueue.html">
<link title="Unixqueue_pollset" rel="Chapter" href="Unixqueue_pollset.html">
<link title="Unixqueue_select" rel="Chapter" href="Unixqueue_select.html">
<link title="Uq_resolver" rel="Chapter" href="Uq_resolver.html">
<link title="Uq_engines" rel="Chapter" href="Uq_engines.html">
<link title="Uq_multiplex" rel="Chapter" href="Uq_multiplex.html">
<link title="Uq_transfer" rel="Chapter" href="Uq_transfer.html">
<link title="Uq_socks5" rel="Chapter" href="Uq_socks5.html">
<link title="Uq_io" rel="Chapter" href="Uq_io.html">
<link title="Uq_lwt" rel="Chapter" href="Uq_lwt.html">
<link title="Uq_libevent" rel="Chapter" href="Uq_libevent.html">
<link title="Uq_mt" rel="Chapter" href="Uq_mt.html">
<link title="Uq_client" rel="Chapter" href="Uq_client.html">
<link title="Uq_server" rel="Chapter" href="Uq_server.html">
<link title="Uq_datagram" rel="Chapter" href="Uq_datagram.html">
<link title="Uq_engines_compat" rel="Chapter" href="Uq_engines_compat.html">
<link title="Equeue_intro" rel="Chapter" href="Equeue_intro.html">
<link title="Equeue_howto" rel="Chapter" href="Equeue_howto.html">
<link title="Netcamlbox" rel="Chapter" href="Netcamlbox.html">
<link title="Netcgi_apache" rel="Chapter" href="Netcgi_apache.html">
<link title="Netcgi_modtpl" rel="Chapter" href="Netcgi_modtpl.html">
<link title="Netcgi_plex" rel="Chapter" href="Netcgi_plex.html">
<link title="Netcgi_common" rel="Chapter" href="Netcgi_common.html">
<link title="Netcgi" rel="Chapter" href="Netcgi.html">
<link title="Netcgi_ajp" rel="Chapter" href="Netcgi_ajp.html">
<link title="Netcgi_scgi" rel="Chapter" href="Netcgi_scgi.html">
<link title="Netcgi_cgi" rel="Chapter" href="Netcgi_cgi.html">
<link title="Netcgi_fcgi" rel="Chapter" href="Netcgi_fcgi.html">
<link title="Netcgi_dbi" rel="Chapter" href="Netcgi_dbi.html">
<link title="Netcgi1_compat" rel="Chapter" href="Netcgi1_compat.html">
<link title="Netcgi_test" rel="Chapter" href="Netcgi_test.html">
<link title="Netcgi_porting" rel="Chapter" href="Netcgi_porting.html">
<link title="Nethttp_client_conncache" rel="Chapter" href="Nethttp_client_conncache.html">
<link title="Nethttp_client" rel="Chapter" href="Nethttp_client.html">
<link title="Nettelnet_client" rel="Chapter" href="Nettelnet_client.html">
<link title="Netftp_data_endpoint" rel="Chapter" href="Netftp_data_endpoint.html">
<link title="Netftp_client" rel="Chapter" href="Netftp_client.html">
<link title="Nethttp_fs" rel="Chapter" href="Nethttp_fs.html">
<link title="Netftp_fs" rel="Chapter" href="Netftp_fs.html">
<link title="Netsmtp" rel="Chapter" href="Netsmtp.html">
<link title="Netpop" rel="Chapter" href="Netpop.html">
<link title="Netldap" rel="Chapter" href="Netldap.html">
<link title="Netclient_tut" rel="Chapter" href="Netclient_tut.html">
<link title="Netgss_bindings" rel="Chapter" href="Netgss_bindings.html">
<link title="Netgss" rel="Chapter" href="Netgss.html">
<link title="Nethttpd_types" rel="Chapter" href="Nethttpd_types.html">
<link title="Nethttpd_kernel" rel="Chapter" href="Nethttpd_kernel.html">
<link title="Nethttpd_reactor" rel="Chapter" href="Nethttpd_reactor.html">
<link title="Nethttpd_engine" rel="Chapter" href="Nethttpd_engine.html">
<link title="Nethttpd_services" rel="Chapter" href="Nethttpd_services.html">
<link title="Nethttpd_plex" rel="Chapter" href="Nethttpd_plex.html">
<link title="Nethttpd_util" rel="Chapter" href="Nethttpd_util.html">
<link title="Nethttpd_intro" rel="Chapter" href="Nethttpd_intro.html">
<link title="Netmcore" rel="Chapter" href="Netmcore.html">
<link title="Netmcore_camlbox" rel="Chapter" href="Netmcore_camlbox.html">
<link title="Netmcore_mempool" rel="Chapter" href="Netmcore_mempool.html">
<link title="Netmcore_heap" rel="Chapter" href="Netmcore_heap.html">
<link title="Netmcore_ref" rel="Chapter" href="Netmcore_ref.html">
<link title="Netmcore_array" rel="Chapter" href="Netmcore_array.html">
<link title="Netmcore_sem" rel="Chapter" href="Netmcore_sem.html">
<link title="Netmcore_mutex" rel="Chapter" href="Netmcore_mutex.html">
<link title="Netmcore_condition" rel="Chapter" href="Netmcore_condition.html">
<link title="Netmcore_queue" rel="Chapter" href="Netmcore_queue.html">
<link title="Netmcore_buffer" rel="Chapter" href="Netmcore_buffer.html">
<link title="Netmcore_matrix" rel="Chapter" href="Netmcore_matrix.html">
<link title="Netmcore_hashtbl" rel="Chapter" href="Netmcore_hashtbl.html">
<link title="Netmcore_process" rel="Chapter" href="Netmcore_process.html">
<link title="Netmcore_tut" rel="Chapter" href="Netmcore_tut.html">
<link title="Netmcore_basics" rel="Chapter" href="Netmcore_basics.html">
<link title="Netplex_types" rel="Chapter" href="Netplex_types.html">
<link title="Netplex_mp" rel="Chapter" href="Netplex_mp.html">
<link title="Netplex_mt" rel="Chapter" href="Netplex_mt.html">
<link title="Netplex_log" rel="Chapter" href="Netplex_log.html">
<link title="Netplex_controller" rel="Chapter" href="Netplex_controller.html">
<link title="Netplex_container" rel="Chapter" href="Netplex_container.html">
<link title="Netplex_sockserv" rel="Chapter" href="Netplex_sockserv.html">
<link title="Netplex_workload" rel="Chapter" href="Netplex_workload.html">
<link title="Netplex_main" rel="Chapter" href="Netplex_main.html">
<link title="Netplex_config" rel="Chapter" href="Netplex_config.html">
<link title="Netplex_kit" rel="Chapter" href="Netplex_kit.html">
<link title="Rpc_netplex" rel="Chapter" href="Rpc_netplex.html">
<link title="Netplex_cenv" rel="Chapter" href="Netplex_cenv.html">
<link title="Netplex_semaphore" rel="Chapter" href="Netplex_semaphore.html">
<link title="Netplex_sharedvar" rel="Chapter" href="Netplex_sharedvar.html">
<link title="Netplex_mutex" rel="Chapter" href="Netplex_mutex.html">
<link title="Netplex_encap" rel="Chapter" href="Netplex_encap.html">
<link title="Netplex_mbox" rel="Chapter" href="Netplex_mbox.html">
<link title="Netplex_internal" rel="Chapter" href="Netplex_internal.html">
<link title="Netplex_intro" rel="Chapter" href="Netplex_intro.html">
<link title="Netplex_advanced" rel="Chapter" href="Netplex_advanced.html">
<link title="Netplex_admin" rel="Chapter" href="Netplex_admin.html">
<link title="Netshm" rel="Chapter" href="Netshm.html">
<link title="Netshm_data" rel="Chapter" href="Netshm_data.html">
<link title="Netshm_hashtbl" rel="Chapter" href="Netshm_hashtbl.html">
<link title="Netshm_array" rel="Chapter" href="Netshm_array.html">
<link title="Netshm_intro" rel="Chapter" href="Netshm_intro.html">
<link title="Netstring_pcre" rel="Chapter" href="Netstring_pcre.html">
<link title="Netconversion" rel="Chapter" href="Netconversion.html">
<link title="Netchannels" rel="Chapter" href="Netchannels.html">
<link title="Netstream" rel="Chapter" href="Netstream.html">
<link title="Netmime_string" rel="Chapter" href="Netmime_string.html">
<link title="Netmime" rel="Chapter" href="Netmime.html">
<link title="Netsendmail" rel="Chapter" href="Netsendmail.html">
<link title="Neturl" rel="Chapter" href="Neturl.html">
<link title="Netaddress" rel="Chapter" href="Netaddress.html">
<link title="Netbuffer" rel="Chapter" href="Netbuffer.html">
<link title="Netmime_header" rel="Chapter" href="Netmime_header.html">
<link title="Netmime_channels" rel="Chapter" href="Netmime_channels.html">
<link title="Neturl_ldap" rel="Chapter" href="Neturl_ldap.html">
<link title="Netdate" rel="Chapter" href="Netdate.html">
<link title="Netencoding" rel="Chapter" href="Netencoding.html">
<link title="Netulex" rel="Chapter" href="Netulex.html">
<link title="Netaccel" rel="Chapter" href="Netaccel.html">
<link title="Netaccel_link" rel="Chapter" href="Netaccel_link.html">
<link title="Nethtml" rel="Chapter" href="Nethtml.html">
<link title="Netstring_str" rel="Chapter" href="Netstring_str.html">
<link title="Netmappings" rel="Chapter" href="Netmappings.html">
<link title="Netaux" rel="Chapter" href="Netaux.html">
<link title="Nethttp" rel="Chapter" href="Nethttp.html">
<link title="Netpagebuffer" rel="Chapter" href="Netpagebuffer.html">
<link title="Netfs" rel="Chapter" href="Netfs.html">
<link title="Netglob" rel="Chapter" href="Netglob.html">
<link title="Netauth" rel="Chapter" href="Netauth.html">
<link title="Netsockaddr" rel="Chapter" href="Netsockaddr.html">
<link title="Netnumber" rel="Chapter" href="Netnumber.html">
<link title="Netxdr_mstring" rel="Chapter" href="Netxdr_mstring.html">
<link title="Netxdr" rel="Chapter" href="Netxdr.html">
<link title="Netcompression" rel="Chapter" href="Netcompression.html">
<link title="Netunichar" rel="Chapter" href="Netunichar.html">
<link title="Netasn1" rel="Chapter" href="Netasn1.html">
<link title="Netasn1_encode" rel="Chapter" href="Netasn1_encode.html">
<link title="Netoid" rel="Chapter" href="Netoid.html">
<link title="Netstring_tstring" rel="Chapter" href="Netstring_tstring.html">
<link title="Netdn" rel="Chapter" href="Netdn.html">
<link title="Netx509" rel="Chapter" href="Netx509.html">
<link title="Netascii_armor" rel="Chapter" href="Netascii_armor.html">
<link title="Nettls_support" rel="Chapter" href="Nettls_support.html">
<link title="Netmech_scram" rel="Chapter" href="Netmech_scram.html">
<link title="Netmech_scram_gssapi" rel="Chapter" href="Netmech_scram_gssapi.html">
<link title="Netmech_scram_sasl" rel="Chapter" href="Netmech_scram_sasl.html">
<link title="Netmech_scram_http" rel="Chapter" href="Netmech_scram_http.html">
<link title="Netgssapi_support" rel="Chapter" href="Netgssapi_support.html">
<link title="Netgssapi_auth" rel="Chapter" href="Netgssapi_auth.html">
<link title="Netchannels_crypto" rel="Chapter" href="Netchannels_crypto.html">
<link title="Netx509_pubkey" rel="Chapter" href="Netx509_pubkey.html">
<link title="Netx509_pubkey_crypto" rel="Chapter" href="Netx509_pubkey_crypto.html">
<link title="Netsaslprep" rel="Chapter" href="Netsaslprep.html">
<link title="Netmech_plain_sasl" rel="Chapter" href="Netmech_plain_sasl.html">
<link title="Netmech_crammd5_sasl" rel="Chapter" href="Netmech_crammd5_sasl.html">
<link title="Netmech_digest_sasl" rel="Chapter" href="Netmech_digest_sasl.html">
<link title="Netmech_digest_http" rel="Chapter" href="Netmech_digest_http.html">
<link title="Netmech_krb5_sasl" rel="Chapter" href="Netmech_krb5_sasl.html">
<link title="Netmech_gs2_sasl" rel="Chapter" href="Netmech_gs2_sasl.html">
<link title="Netmech_spnego_http" rel="Chapter" href="Netmech_spnego_http.html">
<link title="Netchannels_tut" rel="Chapter" href="Netchannels_tut.html">
<link title="Netmime_tut" rel="Chapter" href="Netmime_tut.html">
<link title="Netsendmail_tut" rel="Chapter" href="Netsendmail_tut.html">
<link title="Netulex_tut" rel="Chapter" href="Netulex_tut.html">
<link title="Neturl_tut" rel="Chapter" href="Neturl_tut.html">
<link title="Netsys" rel="Chapter" href="Netsys.html">
<link title="Netsys_posix" rel="Chapter" href="Netsys_posix.html">
<link title="Netsys_pollset" rel="Chapter" href="Netsys_pollset.html">
<link title="Netlog" rel="Chapter" href="Netlog.html">
<link title="Netexn" rel="Chapter" href="Netexn.html">
<link title="Netsys_win32" rel="Chapter" href="Netsys_win32.html">
<link title="Netsys_pollset_posix" rel="Chapter" href="Netsys_pollset_posix.html">
<link title="Netsys_pollset_win32" rel="Chapter" href="Netsys_pollset_win32.html">
<link title="Netsys_pollset_generic" rel="Chapter" href="Netsys_pollset_generic.html">
<link title="Netsys_signal" rel="Chapter" href="Netsys_signal.html">
<link title="Netsys_oothr" rel="Chapter" href="Netsys_oothr.html">
<link title="Netsys_xdr" rel="Chapter" href="Netsys_xdr.html">
<link title="Netsys_rng" rel="Chapter" href="Netsys_rng.html">
<link title="Netsys_crypto_types" rel="Chapter" href="Netsys_crypto_types.html">
<link title="Netsys_types" rel="Chapter" href="Netsys_types.html">
<link title="Netsys_mem" rel="Chapter" href="Netsys_mem.html">
<link title="Netsys_tmp" rel="Chapter" href="Netsys_tmp.html">
<link title="Netsys_sem" rel="Chapter" href="Netsys_sem.html">
<link title="Netsys_pmanage" rel="Chapter" href="Netsys_pmanage.html">
<link title="Netsys_crypto" rel="Chapter" href="Netsys_crypto.html">
<link title="Netsys_tls" rel="Chapter" href="Netsys_tls.html">
<link title="Netsys_ciphers" rel="Chapter" href="Netsys_ciphers.html">
<link title="Netsys_digests" rel="Chapter" href="Netsys_digests.html">
<link title="Netsys_crypto_modes" rel="Chapter" href="Netsys_crypto_modes.html">
<link title="Netsys_gssapi" rel="Chapter" href="Netsys_gssapi.html">
<link title="Netsys_sasl_types" rel="Chapter" href="Netsys_sasl_types.html">
<link title="Netsys_sasl" rel="Chapter" href="Netsys_sasl.html">
<link title="Netsys_polypipe" rel="Chapter" href="Netsys_polypipe.html">
<link title="Netsys_polysocket" rel="Chapter" href="Netsys_polysocket.html">
<link title="Netsys_global" rel="Chapter" href="Netsys_global.html">
<link title="Nettls_gnutls_bindings" rel="Chapter" href="Nettls_gnutls_bindings.html">
<link title="Nettls_nettle_bindings" rel="Chapter" href="Nettls_nettle_bindings.html">
<link title="Nettls_gnutls" rel="Chapter" href="Nettls_gnutls.html">
<link title="Netunidata" rel="Chapter" href="Netunidata.html">
<link title="Netgzip" rel="Chapter" href="Netgzip.html">
<link title="Rpc_auth_local" rel="Chapter" href="Rpc_auth_local.html">
<link title="Rpc_xti_client" rel="Chapter" href="Rpc_xti_client.html">
<link title="Rpc" rel="Chapter" href="Rpc.html">
<link title="Rpc_program" rel="Chapter" href="Rpc_program.html">
<link title="Rpc_util" rel="Chapter" href="Rpc_util.html">
<link title="Rpc_portmapper_aux" rel="Chapter" href="Rpc_portmapper_aux.html">
<link title="Rpc_packer" rel="Chapter" href="Rpc_packer.html">
<link title="Rpc_transport" rel="Chapter" href="Rpc_transport.html">
<link title="Rpc_client" rel="Chapter" href="Rpc_client.html">
<link title="Rpc_simple_client" rel="Chapter" href="Rpc_simple_client.html">
<link title="Rpc_portmapper_clnt" rel="Chapter" href="Rpc_portmapper_clnt.html">
<link title="Rpc_portmapper" rel="Chapter" href="Rpc_portmapper.html">
<link title="Rpc_server" rel="Chapter" href="Rpc_server.html">
<link title="Rpc_auth_sys" rel="Chapter" href="Rpc_auth_sys.html">
<link title="Rpc_auth_gssapi" rel="Chapter" href="Rpc_auth_gssapi.html">
<link title="Rpc_proxy" rel="Chapter" href="Rpc_proxy.html">
<link title="Rpc_intro" rel="Chapter" href="Rpc_intro.html">
<link title="Rpc_mapping_ref" rel="Chapter" href="Rpc_mapping_ref.html">
<link title="Rpc_intro_gss" rel="Chapter" href="Rpc_intro_gss.html">
<link title="Shell_sys" rel="Chapter" href="Shell_sys.html">
<link title="Shell" rel="Chapter" href="Shell.html">
<link title="Shell_uq" rel="Chapter" href="Shell_uq.html">
<link title="Shell_fs" rel="Chapter" href="Shell_fs.html">
<link title="Shell_intro" rel="Chapter" href="Shell_intro.html">
<link title="Intro" rel="Chapter" href="Intro.html">
<link title="Platform" rel="Chapter" href="Platform.html">
<link title="Foreword" rel="Chapter" href="Foreword.html">
<link title="Ipv6" rel="Chapter" href="Ipv6.html">
<link title="Regexp" rel="Chapter" href="Regexp.html">
<link title="Tls" rel="Chapter" href="Tls.html">
<link title="Crypto" rel="Chapter" href="Crypto.html">
<link title="Authentication" rel="Chapter" href="Authentication.html">
<link title="Credentials" rel="Chapter" href="Credentials.html">
<link title="Gssapi" rel="Chapter" href="Gssapi.html">
<link title="Ocamlnet4" rel="Chapter" href="Ocamlnet4.html">
<link title="Get" rel="Chapter" href="Get.html"><link title="Generic file descriptors" rel="Section" href="#1_Genericfiledescriptors">
<link title="Functions for sockets" rel="Section" href="#1_Functionsforsockets">
<link title="Helper functions" rel="Section" href="#1_Helperfunctions">
<link title="IPv6" rel="Section" href="#1_IPv6">
<link title="IP addresses" rel="Section" href="#1_IPaddresses">
<link title="Multicast Functions" rel="Section" href="#1_MulticastFunctions">
<link title="Profiling" rel="Section" href="#1_Profiling">
<link title="Further Documentation" rel="Section" href="#1_FurtherDocumentation">
<link title="Debugging" rel="Section" href="#1_Debugging">
<link title="How to orderly close I/O channels" rel="Subsection" href="#2_HowtoorderlycloseIOchannels">
<title>Ocamlnet 4 Reference Manual : Netsys</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Neturl_tut.html" title="Neturl_tut">Previous</a>
<a class="up" href="index.html" title="Index">Up</a>
<a class="post" href="Netsys_posix.html" title="Netsys_posix">Next</a>
</div>
<h1>Module <a href="type_Netsys.html">Netsys</a></h1>
<pre><span id="MODULENetsys"><span class="keyword">module</span> Netsys</span>: <code class="code">sig</code> <a href="Netsys.html">..</a> <code class="code">end</code></pre><div class="info module top">
<div class="info-desc">
<p>System calls missing in the <code class="code">Unix</code> module</p>
</div>
</div>
<hr width="100%">
<h2 id="1_Genericfiledescriptors">Generic file descriptors</h2><p>Not all OS provide generic read/write functions, or some emulation
layer does not allow to use a descriptor with read/write. In the
following functions, the style of the descriptor can be passed along
with the descriptor to select the right I/O method. Effectively,
the <code class="code">fd_style</code> indicates which I/O function to call. Sometimes it is
mandatory to call this function, sometimes it is only a good advice
because the function provides the best interface for the kind of
descriptor.</p>
<pre><span id="TYPEfd_style"><span class="keyword">type</span> <code class="type"></code>fd_style</span> = <code class="type">[ `Read_write<br> | `Recv_send of Unix.sockaddr * Unix.sockaddr<br> | `Recv_send_implied<br> | `Recvfrom_sendto<br> | `TLS of <a href="Netsys_crypto_types.html#TYPEfile_tls_endpoint">Netsys_crypto_types.file_tls_endpoint</a><br> | `W32_event<br> | `W32_input_thread<br> | `W32_output_thread<br> | `W32_pipe<br> | `W32_pipe_server<br> | `W32_process ]</code> </pre>
<div class="info ">
<div class="info-desc">
<p>Some information what kind of operations are reasonable for descriptors:</p>
<ul>
<li><code class="code">`Read_write</code>: The descriptor is neither a socket not one of the
other special cases, so only read/write is possible if read/write
is possible at all. This style is also used if it is meaningless
to use data I/O like read/write at all.</li>
<li><code class="code">`Recv_send(sockaddr,peeraddr)</code>: The descriptor is a connected socket.
recv/send are the preferred operations.</li>
<li><code class="code">`Recvfrom_sendto</code>: The descriptor is an unconnected socket, and
it is possible to ask for addresses when exchanging data, so
recvfrom/sendto are the preferred operations.</li>
<li><code class="code">`Recv_send_implied</code>: The descriptor is a socket with implied
connection. There are no socket addresses.
recv/send are the preferred operations. It is not possible to call
<code class="code">getsockname</code> or <code class="code">getpeername</code>.</li>
<li><code class="code">`W32_pipe</code>: The descriptor is a proxy descriptor for a Win32 named
pipe as returned by <a href="Netsys_win32.html#VALpipe_descr"><code class="code">Netsys_win32.pipe_descr</code></a>. </li>
<li><code class="code">`W32_pipe_server</code>: The descriptor is a proxy descriptor for a Win32
pipe server as returned by
<a href="Netsys_win32.html#VALpipe_server_descr"><code class="code">Netsys_win32.pipe_server_descr</code></a>. </li>
<li><code class="code">`W32_event</code>: The descriptor is a Win32 proxy descriptor for an event
as returned by <a href="Netsys_win32.html#VALcreate_event"><code class="code">Netsys_win32.create_event</code></a>. It is not possible to
read/write with these descriptors.</li>
<li><code class="code">`W32_process</code>: The descriptor is a proxy descriptor for a Win32
process as returned by
<a href="Netsys_win32.html#VALcreate_process"><code class="code">Netsys_win32.create_process</code></a>. It is not possible to read/write
with these descriptors.</li>
<li><code class="code">`W32_input_thread</code>: The descriptor is a proxy descriptor for a
Win32-specific input thread
as returned by
<a href="Netsys_win32.html#VALcreate_input_thread"><code class="code">Netsys_win32.create_input_thread</code></a>. </li>
<li><code class="code">`W32_output_thread</code>: The descriptor is a proxy descriptor for a
Win32-specific output thread
as returned by
<a href="Netsys_win32.html#VALcreate_output_thread"><code class="code">Netsys_win32.create_output_thread</code></a>. </li>
<li><code class="code">`TLS endpoint</code>: A TLS tunnel is running over the descriptor. The
details of the tunnel can be found in <code class="code">endpoint</code>. Note that it is
allowed that the endpoint uses a second descriptor for either
reading or writing (i.e. reading and writing go via different
descriptors). In this case, it is sufficient that one of these
descriptors is accompanied with <code class="code">`TLS endpoint</code>.</li>
</ul>
<p>Win32: For the exact meaning of proxy descriptors, please see
<a href="Netsys_win32.html"><code class="code">Netsys_win32</code></a>. In short, a proxy descriptor is an abstract handle
for the I/O object. The handle itself cannot be used for I/O, however,
but only some specialized function. The proxy descriptor can only
be used to dereference the I/O object. Note that the following functions
like <code class="code">gread</code> and <code class="code">gwrite</code> automatically look up the I/O object behind
the proxy and call the right I/O function.</p>
</div>
</div>
<pre><span id="VALget_fd_style"><span class="keyword">val</span> get_fd_style</span> : <code class="type">Unix.file_descr -> <a href="Netsys.html#TYPEfd_style">fd_style</a></code></pre><div class="info ">
<div class="info-desc">
<p>Get the file descriptor style.</p>
<p>The following styles cannot be determined automatically:</p>
<ul>
<li><code class="code">`TLS</code></li>
</ul>
</div>
</div>
<pre><span id="VALgread"><span class="keyword">val</span> gread</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> Stdlib.Bytes.t -> int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">gread fd_style fd s pos len</code>: Reads up to <code class="code">len</code> bytes from
descriptor <code class="code">fd</code> which is supposed to support the I/O style
<code class="code">fd_style</code>, i.e. the right system call (<code class="code">read</code>, <code class="code">recv</code>,
<code class="code">recvfrom</code>) is chosen to read from the descriptor.
After <code class="code">n <= len</code> bytes have been read these are put into
string <code class="code">s</code> at positions <code class="code">pos</code> to <code class="code">pos+n-1</code>, and <code class="code">n</code> is returned.
The function can fail with any I/O exception defined for the
actually performed I/O operation. Whether the operation is blocking
or non-blocking depends on the descriptor.</p>
<p>If <code class="code">len>0</code> but <code class="code">n=0</code> the end of the input data is reached.</p>
</div>
</div>
<pre><span id="VALgread_tbuf"><span class="keyword">val</span> gread_tbuf</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -><br> Unix.file_descr -> <a href="Netsys_types.html#TYPEtbuffer">Netsys_types.tbuffer</a> -> int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Same for a tagged buffer</p>
</div>
</div>
<pre><span id="VALblocking_gread"><span class="keyword">val</span> blocking_gread</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> Stdlib.Bytes.t -> int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">let p = blocking_gread fd_style fd s pos len</code>:
Like <code class="code">gread</code> up to <code class="code">len</code> bytes are read from <code class="code">fd</code> and stored in <code class="code">s</code>.
If the I/O operation is blocking but the descriptor is in
non-blocking mode, this function blocks until the operation can
be performed. If the operation is interrupted by a signal it is
automatically restarted.</p>
<p>If <code class="code">n < len</code> the end of the input data is reached (where <code class="code">n</code> is the
returned number).</p>
<p>See <code class="code">wait_until_readable</code> below for further information which
types of descriptors can be handled in non-blocking mode.</p>
</div>
</div>
<pre><span id="VALblocking_gread_tbuf"><span class="keyword">val</span> blocking_gread_tbuf</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -><br> Unix.file_descr -> <a href="Netsys_types.html#TYPEtbuffer">Netsys_types.tbuffer</a> -> int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Same for a tagged buffer</p>
</div>
</div>
<pre><span id="VALreally_gread"><span class="keyword">val</span> really_gread</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> Stdlib.Bytes.t -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">really_read fd_style fd s pos len</code>: Reads exactly <code class="code">len</code> bytes from <code class="code">fd</code>
and stores them in <code class="code">s</code> starting at <code class="code">pos</code>. If the end of file condition
is seen before <code class="code">len</code> bytes are read, the exception <code class="code">End_of_file</code>
is raised, and it is unspecified how many bytes have been stored in
<code class="code">s</code>. Like <code class="code">blocking_gread</code>, non-blocking descriptors are forced
to block until the operation becomes possible, and interruptions by
signals are handled.</p>
<p>See <code class="code">wait_until_readable</code> below for further information which
types of descriptors can be handled in non-blocking mode.</p>
</div>
</div>
<pre><span id="VALreally_gread_tbuf"><span class="keyword">val</span> really_gread_tbuf</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -><br> Unix.file_descr -> <a href="Netsys_types.html#TYPEtbuffer">Netsys_types.tbuffer</a> -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same for a tagged buffer</p>
</div>
</div>
<pre><span id="VALgwrite"><span class="keyword">val</span> gwrite</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> Stdlib.Bytes.t -> int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">gwrite fd_style fd s pos len</code>: Writes up to <code class="code">len</code> bytes to
descriptor <code class="code">fd</code> which is supposed to support the I/O style
<code class="code">fd_style</code>, i.e. the right system call (<code class="code">write</code>, <code class="code">send</code>,
<code class="code">sendto</code>) is chosen to write to the descriptor.
. The <code class="code">n <= len</code> written bytes are taken from string <code class="code">s</code>,
starting at position <code class="code">pos</code> until <code class="code">pos+n-1</code>. The number <code class="code">n</code> is
returned. The function can fail with any I/O exception defined for the
actually performed I/O operation. Whether the operation is blocking
or non-blocking depends on the descriptor.</p>
</div>
</div>
<pre><span id="VALgwrite_tstr"><span class="keyword">val</span> gwrite_tstr</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -><br> Unix.file_descr -> <a href="Netsys_types.html#TYPEtstring">Netsys_types.tstring</a> -> int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Same for a tagged string</p>
</div>
</div>
<pre><span id="VALgwrite_tbuf"><span class="keyword">val</span> gwrite_tbuf</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -><br> Unix.file_descr -> <a href="Netsys_types.html#TYPEtbuffer">Netsys_types.tbuffer</a> -> int -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Same for a tagged buffer</p>
</div>
</div>
<pre><span id="VALreally_gwrite"><span class="keyword">val</span> really_gwrite</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> Stdlib.Bytes.t -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">really_write fd_style fd s pos len</code>: Writes exactly the <code class="code">len</code> bytes
from <code class="code">s</code> to <code class="code">fd</code> starting at <code class="code">pos</code>.
If the I/O operation is blocking but the descriptor is in
non-blocking mode, this function blocks until the operation can
be performed. If the operation is interrupted by a signal it is
automatically restarted.</p>
<p>See <code class="code">wait_until_writable</code> below for further information which
types of descriptors can be handled in non-blocking mode.</p>
</div>
</div>
<pre><span id="VALreally_gwrite_tstr"><span class="keyword">val</span> really_gwrite_tstr</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -><br> Unix.file_descr -> <a href="Netsys_types.html#TYPEtstring">Netsys_types.tstring</a> -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same for a tagged string</p>
</div>
</div>
<pre><span id="VALreally_gwrite_tbuf"><span class="keyword">val</span> really_gwrite_tbuf</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -><br> Unix.file_descr -> <a href="Netsys_types.html#TYPEtbuffer">Netsys_types.tbuffer</a> -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same for a tagged buffer</p>
</div>
</div>
<pre><span id="EXCEPTIONShutdown_not_supported"><span class="keyword">exception</span> Shutdown_not_supported</span></pre>
<div class="info ">
<div class="info-desc">
<p>See <code class="code">gshutdown</code></p>
</div>
</div>
<pre><span id="VALgshutdown"><span class="keyword">val</span> gshutdown</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> Unix.shutdown_command -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">gshutdown fd_style fd cmd</code>: If there is the possibility to shut down
the connection for this kind of descriptor, the shutdown is tried.
It is possible that the function raises the <code class="code">EAGAIN</code> Unix error if
the shutdown operation is non-blocking, and currently not possible.
It is suggested to wait until the descriptor is writable, and to try
again then.</p>
<p>If there is no shutdown operation for this kind of descriptor, the
exception <code class="code">Shutdown_not_supported</code> is raised. In this case it is
usually sufficient to close the descriptor (<code class="code">gclose</code>, see below),
and when all descriptors to the resource are closed, the resource
is shut down by the OS.</p>
<p>Details by <code class="code">fd_style</code>:</p>
<ul>
<li><code class="code">`Recv_send</code> and <code class="code">`Recv_send_implied</code>: The socket is shut
down as requested by <code class="code">Unix.shutdown</code>. This only triggers the
shutdown, but does not wait until it is completed. Also,
errors are usually not immediately reported.</li>
<li><code class="code">`W32_pipe</code>: It is only possible to request <code class="code">SHUTDOWN_ALL</code>
for these descriptors. For other shutdown types, the error
<code class="code">EPERM</code> is reported. The shutdown is synchronous and completed
when the function returns.</li>
<li><code class="code">`W32_pipe_server</code>: It is only possible to request <code class="code">SHUTDOWN_ALL</code>
for these descriptors. For other shutdown types, the error
<code class="code">EPERM</code> is reported. A shutdown means here to stop accepting
new connections. The shutdown is synchronous and completed
when the function returns.</li>
<li><code class="code">`W32_output_thread</code>: It is only possible to request <code class="code">SHUTDOWN_SEND</code>
for these descriptors. A <code class="code">SHUTDOWN_ALL</code> is also interpreted as
<code class="code">SHUTDOWN_SEND</code>, and a <code class="code">SHUTDOWN_RECEIVE</code> is ignored.
A shutdown means here that the EOF is appended
to the output buffer, and when the output thread has written the
buffer contents, the underlying descriptor (not <code class="code">fd</code>!) will be
closed. The shutdown operation is non-blocking. If it is not
possible at the moment of calling, the error <code class="code">EAGAIN</code> is reported.</li>
<li><code class="code">`TLS</code>: The shutdown only affects the tunnel as such, but not the
underlying connection. <code class="code">SHUTDOWN_SEND</code> and <code class="code">SHUTDOWN_ALL</code> are
supported. <code class="code">SHUTDOWN_RECEIVE</code> is ignored.</li>
<li>Other styles raise <code class="code">Shutdown_not_supported</code>.</li>
</ul>
</div>
</div>
<pre><span id="VALis_readable"><span class="keyword">val</span> is_readable</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> bool</code></pre>
<pre><span id="VALis_writable"><span class="keyword">val</span> is_writable</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> bool</code></pre>
<pre><span id="VALis_prird"><span class="keyword">val</span> is_prird</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Test whether the descriptor would not block if one of the input,
output, or priority input operations were done.</p>
<p>On POSIX systems the tests work for a wide variety of descriptor
types (but not for regular files which are assumed to be always
readable and writable).
If the <code class="code">poll</code> interface is available it is preferred over the
<code class="code">select</code> interface to conduct the test.</p>
<p>On Win32, the tests are limited to sockets, named pipes and
event objects. (The latter two only in the form provided by
<a href="Netsys_win32.html"><code class="code">Netsys_win32</code></a>, see there.)</p>
<p>For <code class="code">`TLS</code> fd styles, the functions are "best effort" only.</p>
<p>Generally, if the blocking status cannot be determined for
a class of I/O operations, the functions return <code class="code">true</code>, in
the hope that it is better to block than to never conduct
the operation.</p>
</div>
</div>
<pre><span id="VALwait_until_readable"><span class="keyword">val</span> wait_until_readable</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> float -> bool</code></pre>
<pre><span id="VALwait_until_writable"><span class="keyword">val</span> wait_until_writable</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> float -> bool</code></pre>
<pre><span id="VALwait_until_prird"><span class="keyword">val</span> wait_until_prird</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> float -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Wait until an operation for a single descriptor becomes possible.
The float argument is the timeout (negative value means no timeout).
Returns whether the operation is possible (<code class="code">true</code>). Otherwise,
there was a timeout (<code class="code">false</code>).</p>
<p>On POSIX systems this works for a wide variety of descriptor
types (but not for regular files which are assumed to be always
readable and writable).
If the <code class="code">poll</code> interface is available it is preferred over the
<code class="code">select</code> interface to wait for I/O. The functions also catch
interruptions by signals.</p>
<p>On Win32, waiting is limited to sockets, named pipes and
event objects. (The latter two only in the form provided by
<a href="Netsys_win32.html"><code class="code">Netsys_win32</code></a>, see there.)</p>
<p>For <code class="code">`TLS</code> fd styles, the functions are "best effort" only.</p>
<p>Generally, if waiting is not supported for
a class of I/O operations, the functions return immediately <code class="code">true</code>, in
the hope that it is better to block than to never conduct
the operation.</p>
</div>
</div>
<pre><span id="VALgclose"><span class="keyword">val</span> gclose</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Shuts down the system object referenced by the descriptor so far
possible, and closes the descriptor.</p>
<p>Errors are logged to <a href="Netlog.html"><code class="code">Netlog</code></a> as <code class="code">`Crit</code> events, and
do not generate exceptions.</p>
<p>The exact semantics of the close operation varies from descriptor
style to descriptor style. Generally, <code class="code">gclose</code> assumes that all
I/O is done, and all buffers are flushed, and that one can tear
down the underlying communication circuits. <code class="code">gclose</code> is always
the right choice when the I/O channel needs to be aborted after a
fatal error, and it does not matter whether errors occur or not.
If a data connection needs to be orderly closed (i.e. without
data loss), one should first try to finish the communication,
either by protocol means (e.g. wait for ACK messages), or by
calling <code class="code">gshutdown</code> first (see above).</p>
</div>
</div>
<h2 id="1_Functionsforsockets">Functions for sockets</h2>
<pre><span id="VALwait_until_connected"><span class="keyword">val</span> wait_until_connected</span> : <code class="type">Unix.file_descr -> float -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>After a non-blocking connect has been initiated, this function can be
used to wait until (1) the connect is successful, or (2) the connect
fails, or (3) the operation times out. The <code class="code">float</code> argument is the
timeout value (negative value means no timeout).
The function returns <code class="code">true</code> for the cases (1) and (2), and <code class="code">false</code>
for case (3). The cases (1) and (2) can be further analyzed by
calling <code class="code">connect_check</code> (see below).</p>
<p>On POSIX, this function is identical to <code class="code">wait_until_writable</code>. On
Win32 the wait condition is slightly different.</p>
<p>On Win32, this function also tolerates client proxy descriptors for
Win32 named pipes. However, there is no waiting - the function
immediately returns.</p>
</div>
</div>
<pre><span id="VALconnect_check"><span class="keyword">val</span> connect_check</span> : <code class="type">Unix.file_descr -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Tests whether the socket is connected with the peer after calling
<code class="code">Unix.connect</code>. If the socket is connected, the function returns normally.
Otherwise, the current socket error is raised as a <code class="code">Unix.Unix_error</code>
exception. This function is intended to be called after a
non-blocking connect has been initiated, and the success or error
is indicated (e.g. after <code class="code">wait_until_connected</code> returns).</p>
<p>Side effect: The per-socket error code may be reset.</p>
<p>On Win32, this function also tolerates client proxy descriptors for
Win32 named pipes. However, there is no real check - the function
immediately returns.</p>
</div>
</div>
<pre><span id="VALdomain_of_inet_addr"><span class="keyword">val</span> domain_of_inet_addr</span> : <code class="type">Unix.inet_addr -> Unix.socket_domain</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the socket domain of Internet addresses, i.e. whether the
address is IPv4 or IPv6</p>
</div>
</div>
<pre><span id="VALprotostring_of_inet_addr"><span class="keyword">val</span> protostring_of_inet_addr</span> : <code class="type">Unix.inet_addr -> string</code></pre>
<pre><span id="VALinet_addr_of_protostring"><span class="keyword">val</span> inet_addr_of_protostring</span> : <code class="type">string -> Unix.inet_addr</code></pre><div class="info ">
<div class="info-desc">
<p>Converts an IP address to the 4 bytes (IPv4) or 16 bytes (IPv6)
representation in network byte order, and vice-versa</p>
</div>
</div>
<pre><span id="VALgetpeername"><span class="keyword">val</span> getpeername</span> : <code class="type">Unix.file_descr -> Unix.sockaddr</code></pre><div class="info ">
<div class="info-desc">
<p>like <code class="code">Unix.getpeername</code>, but errors are fixed up. <code class="code">ENOTCONN</code> is
ensured when the socked is unconnected or shut down.</p>
</div>
</div>
<h2 id="1_Helperfunctions">Helper functions</h2>
<pre><span id="VALis_absolute"><span class="keyword">val</span> is_absolute</span> : <code class="type">string -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Whether this file path is absolute. Works for Unix and Win32.</p>
</div>
</div>
<pre><span id="VALabspath"><span class="keyword">val</span> abspath</span> : <code class="type">string -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return an absolute path for this file. When <a href="Netsys_posix.html#VALrealpath"><code class="code">Netsys_posix.realpath</code></a>
is available, this function is called, and the canonical path is
returned. On Win32, first an arbitrary absolute path is created,
and then the path is tried to be simplified by resolving "." and "..".
If neither method works, the function raises <code class="code">Invalid_argument</code>.</p>
<p>Note that the file needs to exist in general.</p>
</div>
</div>
<pre><span id="VALrestart"><span class="keyword">val</span> restart</span> : <code class="type">('a -> 'b) -> 'a -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">restart f arg</code> calls <code class="code">f arg</code>, and restarts this call if the
exception <code class="code">Unix_error(EINTR,_,_)</code> is caught.</p>
<p>Note that there are some cases where this handling of <code class="code">EINTR</code> is
not sufficient:</p>
<ul>
<li>Functions that have a timeout argument like <code class="code">Unix.select</code>: When
<code class="code">EINTR</code> is caught the timeout should be adjusted.</li>
<li><code class="code">Unix.connect</code> with a blocking descriptor because this is not
well-enough specified by POSIX</li>
</ul>
</div>
</div>
<pre><span id="VALrestart_tmo"><span class="keyword">val</span> restart_tmo</span> : <code class="type">(float -> 'b) -> float -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">restart_tmo f tmo</code> calls <code class="code">f</code> with a timeout argument <code class="code">tmo</code>, and
restarted the call if the exception <code class="code">Unix_error(EINTR,_,_)</code> is caught.
In the restart case, the timeout argument is reduced by the
already elapsed time.</p>
<p>Negative timeout arguments are interpreted as "no timeout".</p>
</div>
</div>
<pre><span id="VALrestarting_select"><span class="keyword">val</span> restarting_select</span> : <code class="type">Unix.file_descr list -><br> Unix.file_descr list -><br> Unix.file_descr list -><br> float -> Unix.file_descr list * Unix.file_descr list * Unix.file_descr list</code></pre><div class="info ">
<div class="info-desc">
<p>A wrapper around <code class="code">Unix.select</code> that handles the <code class="code">EINTR</code> condition.</p>
<p>Note: This function calls <code class="code">Unix.select</code> and shares all pros and cons
with <code class="code">Unix.select</code>. In particular, the OS often sets a limit on the
number (and/or the numeric value) of the descriptors (e.g. for
Linux it is 1024, for Windows it is 64). On Ocaml 3.11 the Windows
version of <code class="code">Unix.select</code> includes some support for other types
of descriptors than sockets.</p>
</div>
</div>
<pre><span id="VALrestart_wait"><span class="keyword">val</span> restart_wait</span> : <code class="type">[ `R | `W ] -> <a href="Netsys.html#TYPEfd_style">fd_style</a> -> Unix.file_descr -> ('a -> 'b) -> 'a -> 'b</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">restart_wait mode fd_style fd f arg</code>: Calls <code class="code">f arg</code>, and handles
the following exceptions:</p>
<ul>
<li><code class="code">Unix_error(EINTR,_,_)</code>: Just calls <code class="code">f</code> again</li>
<li><code class="code">Unix_error(EAGAIN,_,_)</code>: waits until <code class="code">fd</code> is readable or writable
as designated by <code class="code">mode</code>, and calls <code class="code">f</code> again</li>
<li><code class="code">Unix_error(EWOUDLBLOCK,_,_)</code>: same</li>
<li><a href="Netsys_types.html#EXCEPTIONEAGAIN_RD"><code class="code">Netsys_types.EAGAIN_RD</code></a>: waits until <code class="code">fd</code> is readable, and calls
<code class="code">f</code> again</li>
<li><a href="Netsys_types.html#EXCEPTIONEAGAIN_WR"><code class="code">Netsys_types.EAGAIN_WR</code></a>: waits until <code class="code">fd</code> is writable, and calls
<code class="code">f</code> again</li>
</ul>
</div>
</div>
<pre><span id="VALsleep"><span class="keyword">val</span> sleep</span> : <code class="type">float -> unit</code></pre>
<pre><span id="VALrestarting_sleep"><span class="keyword">val</span> restarting_sleep</span> : <code class="type">float -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sleep for the passed time. <code class="code">restarting_sleep</code> additionally handles
<code class="code">EINTR</code>.</p>
</div>
</div>
<pre><span id="VALunix_error_of_code"><span class="keyword">val</span> unix_error_of_code</span> : <code class="type">int -> Unix.error</code></pre><div class="info ">
<div class="info-desc">
<p>Converts an integer error into the corresponding variant</p>
</div>
</div>
<pre><span id="VALint64_of_file_descr"><span class="keyword">val</span> int64_of_file_descr</span> : <code class="type">Unix.file_descr -> int64</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the file descriptor as int64 number. Works for all OS.</p>
</div>
</div>
<pre><span id="VALstring_of_fd"><span class="keyword">val</span> string_of_fd</span> : <code class="type">Unix.file_descr -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return a string describing the descriptor (for debugging)</p>
</div>
</div>
<pre><span id="VALstring_of_sockaddr"><span class="keyword">val</span> string_of_sockaddr</span> : <code class="type">?norm:bool -> Unix.sockaddr -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Returns a human-readable string describing the address
(for debug messages). If <code class="code">norm</code>, IPv4 addresses mapped to the IPv6
address space are returned in the normal dotted quad format (i.e.
x.y.z.u instead of ::ffff:x.y.z.u).</p>
<p>Note that the reverse (parsing such a string) can be
accomplished with <a href="Netsockaddr.html#VALsocksymbol_of_string"><code class="code">Netsockaddr.socksymbol_of_string</code></a> and
<a href="Uq_resolver.html#VALsockaddr_of_socksymbol"><code class="code">Uq_resolver.sockaddr_of_socksymbol</code></a>.</p>
</div>
</div>
<pre><span id="VALstring_of_fd_style"><span class="keyword">val</span> string_of_fd_style</span> : <code class="type"><a href="Netsys.html#TYPEfd_style">fd_style</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Returns a string describing the fd style (debugging)</p>
</div>
</div>
<pre><span id="VALis_stdin"><span class="keyword">val</span> is_stdin</span> : <code class="type">Unix.file_descr -> bool</code></pre>
<pre><span id="VALis_stdout"><span class="keyword">val</span> is_stdout</span> : <code class="type">Unix.file_descr -> bool</code></pre>
<pre><span id="VALis_stderr"><span class="keyword">val</span> is_stderr</span> : <code class="type">Unix.file_descr -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Returns whether the descriptors are stdin/stdout/stderr</p>
</div>
</div>
<pre><span id="VALset_close_on_exec"><span class="keyword">val</span> set_close_on_exec</span> : <code class="type">Unix.file_descr -> unit</code></pre>
<pre><span id="VALclear_close_on_exec"><span class="keyword">val</span> clear_close_on_exec</span> : <code class="type">Unix.file_descr -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Working versions of the functions with the same name in <code class="code">Unix</code></p>
</div>
</div>
<pre><span id="VAL_exit"><span class="keyword">val</span> _exit</span> : <code class="type">int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Exit the program immediately without running the atexit handlers.
The argument is the exit code, just as for <code class="code">exit</code>.</p>
</div>
</div>
<h2 id="1_IPv6">IPv6</h2>
<pre><span id="VALis_ipv6_system"><span class="keyword">val</span> is_ipv6_system</span> : <code class="type">unit -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Whether IPv6 is available and usable. At the moment this tests for
the presence of a global IPv6 address on any interface. The test
also requires that the getifaddrs() call is available. The test
can be overridden with <code class="code">set_ipv6_system</code>.</p>
</div>
</div>
<pre><span id="VALset_ipv6_system"><span class="keyword">val</span> set_ipv6_system</span> : <code class="type">bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Sets whether IPv6 is usable</p>
</div>
</div>
<h2 id="1_IPaddresses">IP addresses</h2>
<pre><span id="VALlogand_inet_addr"><span class="keyword">val</span> logand_inet_addr</span> : <code class="type">Unix.inet_addr -> Unix.inet_addr -> Unix.inet_addr</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the bitwise AND of the two argument addresses</p>
</div>
</div>
<pre><span id="VALlogor_inet_addr"><span class="keyword">val</span> logor_inet_addr</span> : <code class="type">Unix.inet_addr -> Unix.inet_addr -> Unix.inet_addr</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the bitwise OR of the two argument addresses</p>
</div>
</div>
<pre><span id="VALlogxor_inet_addr"><span class="keyword">val</span> logxor_inet_addr</span> : <code class="type">Unix.inet_addr -> Unix.inet_addr -> Unix.inet_addr</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the bitwise XOR of the two argument addresses</p>
</div>
</div>
<pre><span id="VALlognot_inet_addr"><span class="keyword">val</span> lognot_inet_addr</span> : <code class="type">Unix.inet_addr -> Unix.inet_addr</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the bitwise NOT of the argument address</p>
</div>
</div>
<pre><span id="VALnorm_inet_addr"><span class="keyword">val</span> norm_inet_addr</span> : <code class="type">Unix.inet_addr -> Unix.inet_addr</code></pre><div class="info ">
<div class="info-desc">
<p>Normalization: If the input address is an IPv4 address mapped into the
IPv6 address space, the IPv4 address is extracted. Otherwise, the input
address is returned unchanged.</p>
</div>
</div>
<pre><span id="VALipv6_inet_addr"><span class="keyword">val</span> ipv6_inet_addr</span> : <code class="type">Unix.inet_addr -> Unix.inet_addr</code></pre><div class="info ">
<div class="info-desc">
<p>IPv6-ification: If the input address is for IPv4, it is mapped to the
IPv6 address space (so an IPv6 socket can be bound)</p>
</div>
</div>
<pre><span id="VALis_ipv4_inet_addr"><span class="keyword">val</span> is_ipv4_inet_addr</span> : <code class="type">Unix.inet_addr -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Whether the address is an IPv4 address (including IPv4 addresses mapped
into the IPv6 adress space)</p>
</div>
</div>
<pre><span id="VALis_ipv6_inet_addr"><span class="keyword">val</span> is_ipv6_inet_addr</span> : <code class="type">Unix.inet_addr -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Whether the address is an IPv6 address (excluding IPv4 addresses mapped
into the IPv6 adress space)</p>
</div>
</div>
<pre><span id="VALis_multicast_inet_addr"><span class="keyword">val</span> is_multicast_inet_addr</span> : <code class="type">Unix.inet_addr -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>Whether the address is a multicast address (either IPv4 or IPv6)</p>
</div>
</div>
<h2 id="1_MulticastFunctions">Multicast Functions</h2>
<pre><span id="VALmcast_set_loop"><span class="keyword">val</span> mcast_set_loop</span> : <code class="type">Unix.file_descr -> bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Whether sent multicast messages are received by the sending host</p>
</div>
</div>
<pre><span id="VALmcast_set_ttl"><span class="keyword">val</span> mcast_set_ttl</span> : <code class="type">Unix.file_descr -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Set TTL/hops value</p>
</div>
</div>
<pre><span id="VALmcast_add_membership"><span class="keyword">val</span> mcast_add_membership</span> : <code class="type">Unix.file_descr -> Unix.inet_addr -> Unix.inet_addr -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Join a multicast group.</p>
<p>First inet addr is the group to join. Second inet addr selects the
network interface (or <code class="code">Unix.inet_addr_any</code>).</p>
</div>
</div>
<pre><span id="VALmcast_drop_membership"><span class="keyword">val</span> mcast_drop_membership</span> : <code class="type">Unix.file_descr -> Unix.inet_addr -> Unix.inet_addr -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Leave a multicast group.</p>
<p>First inet addr is the group to leave. Second inet addr selects the
network interface (or <code class="code">Unix.inet_addr_any</code>).</p>
</div>
</div>
<h2 id="1_Profiling">Profiling</h2>
<pre><span id="VALmoncontrol"><span class="keyword">val</span> moncontrol</span> : <code class="type">bool -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Interface to the <code class="code">moncontrol</code> routine of the GPROF profiler.
<code class="code">moncontrol false</code> stops profiling; <code class="code">moncontrol true</code> starts
profiling again.</p>
<p>This is a no-op if the program is not compiler for profiling.</p>
</div>
</div>
<h2 id="1_FurtherDocumentation">Further Documentation</h2><h3 id="2_HowtoorderlycloseIOchannels">How to orderly close I/O channels</h3>
<p>After reading from uni-directional descriptors, and seeing the
EOF, it is usually sufficient to call <code class="code">gclose</code> to free OS resources.</p>
<p>After writing to uni-directional descriptors one should call
<code class="code">gshutdown</code> to send an EOF (<code class="code">SHUTDOWN_SEND</code>). For some descriptors
one will get the exception <code class="code">Shutdown_not_supported</code> which can be
ignored in this context The <code class="code">gshutdown</code> function cannot,
however, report in all cases whether the operation was successful.
As a rule of thumb, error reporting works for local data connections,
but not always for remote connections, and there is no way to fix
this. After writing EOF, call <code class="code">gclose</code> to free OS resources.</p>
<p>For bidirectional connections, it is even more complicated. If the
connection is local, a bidirectional connection behaves much like a pair
of unidirectional connections. However, in the network case, we have
to go down to the protocol level.</p>
<p>For TCP the golden rule is that the client initiates the connection,
and the client finishes the connection. The case that the server
finishes the connection is not well-specified - or better, the server needs
the ACK from the client after triggering the connection termination.
In practice we have the cases:</p>
<ul>
<li>Client sends EOF, and server replies with EOF: This is the normal
case for which TCP is designed. Client code can invoke
<code class="code">gshutdown</code> with <code class="code">SHUTDOWN_SEND</code> and then waits until the EOF from
the server arrives,
and then <code class="code">gclose</code>s the descriptor. It may happen that the client
gets an error if some problem occurs, so this is reliable from the
perspective of the client. The server first sees the EOF from the
client, and then responds with another <code class="code">gshutdown</code>, followed by
<code class="code">gclose</code>. From the server's perspective it does not matter whether
the operation results in an error or not - the client has lost
interest anyway.</li>
<li>Client sends EOF, and server replies with data, and then EOF.
Here, the client has to read the final data, and then wait for the
server's EOF after sending its own EOF. On the server's side,
some data is written before the final EOF. The question is how
the server can be sure that the data really arrived. Unfortunately,
there is no way to do so. The server may not get all errors because
these may arrive at the server computer after <code class="code">gshutdown</code>. There
is no way to fix this. (One should better fix the application protocol.
Note
that even prominent researchers trapped into this problem. For example,
the first version of HTTP had this problem.)</li>
<li>Server sends EOF, and client replies with EOF: This is the difficult
case. Here, the server wants to be sure that the data sent immediately
before its EOF really arrives at the client. After <code class="code">gshutdown</code>
it is forbidden to immediately <code class="code">gclose</code>, because this may result
in a connection reset. Instead, the server has to wait for the
client's EOF. (This is called "lingering".) If the client's EOF is
seen one can <code class="code">gclose</code>.</li>
<li>Server sends EOF, and client replies with data, followed by EOF:
I admit I don't know whether TCP can handle this somehow.</li>
</ul>
<h2 id="1_Debugging">Debugging</h2>
<pre><span id="MODULEDebug"><span class="keyword">module</span> <a href="Netsys.Debug.html">Debug</a></span>: <code class="code">sig</code> <a href="Netsys.Debug.html">..</a> <code class="code">end</code></pre></body></html>
|