PreviousUpNext

15.4.1203  src/lib/std/src/socket/internet-socket.pkg

## internet-socket.pkg

# Compiled by:
#     src/lib/std/standard.lib


stipulate
    package is  =  internet_socket__premicrothread;                             # internet_socket__premicrothread       is from   src/lib/std/src/socket/internet-socket--premicrothread.pkg
    package pre =  proto_socket;                                                # proto_socket                          is from   src/lib/std/src/socket/proto-socket.pkg
    package sok =  socket__premicrothread;                                      # socket__premicrothread                is from   src/lib/std/socket--premicrothread.pkg
    package tps =  plain_socket;                                                # plain_socket                          is from   src/lib/std/src/socket/plain-socket.pkg
    package ts  =  socket;                                                      # socket                                is from   src/lib/std/src/socket/socket.pkg
herein

    package   internet_socket
    : (weak)  Internet_Socket                                                   # Internet_Socket                       is from   src/lib/std/src/socket/internet-socket.api
    {
        Inet = is::Inet;                                                        # Witness type for sockets.

        Threadkit_Socket(X) =  ts::Threadkit_Socket (Inet, X); 
        Stream_Socket(X)    =  Threadkit_Socket( sok::Stream(X) );
        Datagram_Socket     =  Threadkit_Socket( sok::Datagram );

        Socket_Address      =  sok::Socket_Address( Inet );

        inet_af = is::inet_af;

        to_address   = is::to_address;
        from_address = is::from_address;
        any          = is::any;

        package udp {
            #
            fun make_socket ()
                =
                tps::make_socket (inet_af, sok::typ::datagram);

            fun make_socket' proto
                =
                tps::make_socket' (inet_af, sok::typ::datagram, proto);
        };

        package tcp {
            #
            fun make_socket ()
                =
                tps::make_socket (inet_af, sok::typ::stream);

            fun make_socket' proto
                =
                tps::make_socket' (inet_af, sok::typ::stream, proto);


            # TCP control options: 
            #
            fun get_nodelay (pre::THREADKIT_SOCKET { socket, ... } )
                =
                is::tcp::get_nodelay socket;
            #
            fun set_nodelay (pre::THREADKIT_SOCKET { socket, ... }, flag)
                =
                is::tcp::set_nodelay (socket, flag);
        };
    };
end;

## COPYRIGHT (c) 1996 AT&T Research.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext