psh_socket(3)

SYNOPSIS

popen socket id domain type protocol[ nonblock ]

socket.errno

pclose id

id.send pkt [flags]

id.recv pkt flags [timeout]

id.listen backlog

id.bind sockaddr

id.connect sockaddr

id.setsockopt level option value [lngtime]

id.getsockopt level option

id.accept new-id [timeout]

id.atmark arg

id.shutdown how

id.read pkt [timeout]

id.write pkt

id.recvfrom pkt flags [timeout]

id.sendto pkt flags sockaddr

id.getpeername

id.getsockname

id.readv pkt [pkt ...]

id.writev pkt [pkt ...]

id.sendmsg pkt [pkt ...]

id.mib field-name

id.poll timeout

id.setipsr [!] hop1 hop2 ... dst

DESCRIPTION

popen socket id domain type protocol[nonblock]
    Creates an endpoint for communication and returns a descriptor id. The domain parameter specifies a communications domain within which communication will take place; this selects the protocol family which should be used. The currently understood formats are: unix (UNIX system internal procotols), inet (ARPA Internet protocols), inet6 (Internet Protocol, Version 6). The socket has the indicated type, which specifies communications semantics. Currently defined types are: stream, dgram, raw, seqpacket, rdm. The protocol specifies a particular protocol to be used with the socket. The currently understood formats are: udp, tcp, icmp, raw. If the string nonblock is appended, the new socket is set to do non-blocking I/O with the O_NONBLOCK fcntl(2) system call.

pclose id
    Close the indicated end-point <id>.

socket.errno
    Returns errno in literal form of last abnormal finished socket operation.

id.send pkt [flags]
    Used to transmit a message pkt to another transport end-point. It may be used only when the socket is in a connected state. The optional flags parameter indicates: OOB, DONTROUTE.

id.recv pkt flags [timeout]
    Used to receive a message pkt from another socket. It may be used only on a connected socket. The flags flags parameter indicates: OOB, PEEK. If the timeout parameter is present, it will wait only timeout millseconds for a packet to be received. This command returns either the string "packet" if a packet was received, or "timeout" if a timeout occured before a packet was received.

id.listen backlog
    Listen for connections on a socket. The backlog parameter defines the maximum length the queue of pending connections may grow to.

id.bind sockaddr
    Assigns a name to an unnamed socket. The sockaddr structure is specified like inet:129.146.86.183/8000 or inet6:fe80::a00:20ff:fe12:8bc3/20000. The inet(inet6) is optional otherwise it defaults to the default address family.

id.connect sockaddr
    Initiate a connection on a socket. The sockaddr structure is specified like inet:129.146.86.183/8000 or inet6:fe80::a00:20ff:fe12:8bc3/20000. The inet(inet6) is optional otherwise it defaults to the default address family.

id.setsockopt level option value [lngtime]
    Manipulates the options option associated with a socket. Options may exist at multiple protocol levels level. The following option options are available:
        broadcast
        debug
        dontroute
        error
        keepalive
        linger
        oobinline
        rcvbuf
        sndbuf
        rcvlowat
        sndlowat
        rcvtimeo
        sndtimeo
        reuseaddr
        type
        useloopback
        tcp_nodelay
        tcp_maxseg
        tcp_notify_threshold
        tcp_abort_threshold
        tcp_conn_notify_threshold
        tcp_conn_abort_threshold

    For the linger option a optional linger time argument can be specified in lngtime.

id.getsockopt level option
    Gets the value with the option option associated with a socket id. Options may exist at multiple protocol levels level. For the available different options option see setsockopt above.

id.accept new-id [timeout]
    It extracts the first connection on the queue of pending connections, creates a new socket new-id with the properties of id. The argument id is a socket that has been created with popen and bound to an address with bind, and that is listening for connections after a call to listen. If the timeout parameter is present, it will wait only timeout milliseconds for a connection request to be received. This command returns either the string "accepted" if a connection request was received, or "timeout" if a timeout occured before a connection request was received.

id.atmark arg
    Performs an ioctl(SIOCATMARK) to determine whether at the atmark. It returns either "mark" or "!mark" with the socket associated with id. The valid args are the following: ANYMARK, LASTMARK.

id.shutdown how
    Shuts down all or part of a full-duplex connection on the socket associated with id. If how is 0, then further receives will be disallowed. If how is 1, then further sends will be disallowed. If how is 2, then further sends and receives will be disallowed.

id.read pkt [timeout]
    Read attempts to read (sizeof of pkt) n bytes from the socket associated with id into the buffer pointed to by pkt. If the timeout parameter is present, it will wait only timeout milliseconds for a packet to be received. This command returns either the string "packet" if a packet was received, or "timeout" if a timeout occured before a packet was received.

id.write pkt
    Write attempts to write (sizeof of pkt) n bytes from the socket associated with id into the buffer pointed to by pkt.

id.recvfrom pkt flags [timeout]
    Used to receive messages from another socket. It may be used to receive data on a socket whether it is in a connected state or not on the socket associated with id. The optional flags parameter indicates: OOB, DONTROUTE. If the <timeout> parameter is present, it will wait only timeout milliseconds for a packet to be received. This command returns either the string "packet" if a packet was received, or "timeout" if a timeout occured before a packet was received.

id.sendto pkt flags sockaddr
    Used to transmit a message to another transport end-point. It may be used at any time on the socket associated with id. The optional flags parameter indicates: OOB, DONTROUTE. The address of the target is specified by the sockaddr parameter. The sockaddr structure is specified like inet:129.146.86.183/8000 or inet6:fe80::a00:20ff:fe12:8bc3/20000. The inet(inet6) is optional otherwise it defaults to the default address family.

id.getpeername
    Returns the name of the peer connected to the socket associated with id.

id.getsockname
    Returns the current name for the socket associated with id.

id.readv pkt [pkt ...]
    Performs the same as read, but places the input data into the buffers specified by members of the array: pkt pkt pkt and so forth with the socket associated by id. Note it always fills one buffer pkt completely before proceeding to the next.

id.writev pkt [<pkt> ...]
    Performs the same as write, but gathers the output data from the buffers specified by members of the array: pkt pkt pkt and so forth with the socket associated by id.

id.sendmsg [addr] pkt [<pkt> ...] [flags]
     Send a message on a socket, gathers the output data from the buffers specified by members of the array: pkt pkt pkt and so forth with the socket associated by id. The optional flags parameter indicates: OOB, EOR. If the socket is connection mode, the destination address addr should be omited.

id.mib field-name
    Get MIB (Management Information Base) information about the TCP/UDP groups. It returns the value of specified field-name. The valid fields for tcp (see struct mib2_tcp <inet/mib2.h>) for Solaris are the following:

    tcpRtoAlgorithm tcpRtoMin tcpMaxConn tcpActiveOpens
    tcpPassiveOpens tcpAttemptFails tcpEstabResets tcpCurrEstab
    tcpOutSegs tcpOutDataSegs tcpOutDataBytes tcpRetransSegs
    tcpRetransBytes tcpOutAck tcpOutAckDelayed tcpOutUrg
    tcpOutWinUpdate tcpOutWinProbe tcpOutControl tcpOutRsts
    tcpOutFastRetrans tcpInDataPartDupSegs tcpInAckSegs tcpInAckBytes
    tcpInDataDupSegs tcpRtoMax tcpInClosed tcpInSegs
    tcpInDupAck tcpInAckUnsent tcpInDataInorderSegs
    tcpTimRetransDrop tcpInDataUnorderBytes tcpInDataPartDupBytes
    tcpTimRetrans tcpInWinProbe tcpInWinUpdate
    tcpRttNoUpdate tcpRttUpdate tcpInDataPastWinBytes
    tcpTimKeepalive tcpTimKeepaliveProbe tcpTimKeepaliveDrop
    tcpListenDrop tcpInDataInorderBytes tcpInDataUnorderSegs
    tcpInDataDupBytes tcpInDataPastWinSegs tcpConnTableSize
    tcpListenDropQ0 tcpHalfOpenDrop

    Exactly which MIB entries are supported will depend on the system.

    The valid fields for udp (see struct mib2_udp <inet/mib2.h>) for Solaris are the following:

    udpInDatagrams udpInErrors udpOutDatagrams udpEntrySize

id.poll timeout
    Performs poll() call for the socket associated with id. Requested events are POLLIN|POLLRDBAND|POLLRDNORM|POLLPRI. Returns the current bitmask of occurred events in literal form or "timeout" if none of the above events have occurred.

id.setipsr [!] hop1 hop2 ... dst
    Set source route for the socket associated with id. If ! is present, it is strict source route, otherwise it is loose source route.

FILES

/opt/psh/lib/socket
    Dynamically linked library protocol for data.

SEE ALSO
xpsh(1), psh(1), protolib(3).