INT 15 U - DESQview v2.50+ - SOCKET API
AX = DE2Eh
DX:BX -> socket record or 0000h:0000h to create a new socket record
Return: CX = size of socket record in bytes
DX:BX -> socket record which was used
Notes:  DESQview 2.50-2.52 are distributed as part of DESQview/X v1.0x.
socket records are allocated from common memory
for Unix compatibility, each socket and connection on a socket is
allocated a DOS file handle (referencing an SFT for NUL) which is
used on various calls to specify which of possibly multiple
connections is to be operated upon
SeeAlso: INT 63"DESQview"

Format of socket record:
Offset  Size    Description
00h    WORD    signature F0ADh
02h    WORD    function number
0000h initialize socket???
0001h "gethostname"
0002h "ioctl" check for input
0003h "sleep" delay for specified period
0004h "htons" convert word to network (big-endian) byte order
0005h "select"
0006h "bsd_close"/"so_close" close socket
0007h NOP
0008h "connect" initiate connection on socket
0009h "recv"/"recvfrom" read from socket
000Ah "socket"
000Bh ???
000Ch "gethostbyname"
000Dh "send"/"sendto" write to socket
000Eh ??? (does something to all connections for process)
000Fh "getpid" get process identifier
0010h "gettimeofday"
0011h "bind" assign name to socket
0012h "listen" listen for connections on socket
0013h "accept" accept connection on socket
0014h connect to X server
0015h "gethostbyaddr" get host information for an address
0016h "getprotobyname"
0017h "getprotobynumber"
0018h "getservbyname"
0019h "getservbyport"
001Ah "getsockname" determine name bound to socket
001Bh "getpeername" get name of connected peer
001Ch "getsockopt"/"setsockopt"
001Dh "so_exit"  close all sockets for calling process
001Eh "issock" determine whether file handle references socket
001Fh "so_attach" reattach previously detached socket
0020h "so_detach" temporarily detach socket
0021h get DESQview directory
0022h "NewProc" start new application (see AX=102Ch)
0023h "so_linkup"
0024h canonicalize filename
0025h indirect INT 15h call
0026h Network Manager interface
0027h "so_unlink"    close connection from "so_linkup"
0028h "raisepriority"
0029h "lowerpriority"
002Ah ???
FFFFh "NetExit" (appears to be a NOP)
04h    WORD    returned error code (see below)
06h    WORD    maximum message size??? (usually 0400h)
08h    WORD    PSP segment to use or 0000h if socket not valid
0Ah    WORD    scratch space (JFT size)
0Ch    DWORD   scratch space (JFT address)
10h    DWORD   mailbox handle (initialized by function 0000h)
14h    DWORD   timer object handle (initialized by function 0000h)
---function 0000h---
18h    WORD    (return) ???
---function 0001h---
18h    WORD    (return) status???
1Ah 128 BYTEs  (return) ASCIZ hostname (empty string if not on network)
9Ah    WORD    maximum length of hostname to return
---function 0002h---
18h    WORD    (return) status
1Ah    WORD    socket's file handle
1Ch    WORD    IOCTL function
05h "FIONREAD" determine available input
06h "FIONBIO" set blocking state of socket
1Eh    WORD    (return, subfn 05h) number of bytes available for reading
(call, subfn 06h) 0000h blocking, nonzero nonblocking
---function 0003h---
18h  2 BYTEs   unused
1Ah    WORD    delay time in seconds
---function 0004h---
18h    WORD    (return) result in network (big-endian) byte order
1Ah    WORD    value to convert to network byte order
---function 0005h---
18h    WORD    (return) number of handles meeting the specified conditions???
1Ah    WORD    number of file handles in each bitset???
1Ch    DWORD   bitset of socket handles to check for readability???
20h    DWORD   bitset of socket handles to check for writability???
24h    DWORD   bitset of socket handles to check for errors???
28h    WORD    timeout in ??? or 0000h to block until some socket ready
2Ah    DWORD   ???
2Eh    DWORD   ???
---function 0006h---
18h    WORD    (return) status: 0000h if successful, FFFFh on error
1Ah    WORD    socket's file handle
---function 0008h---
18h    WORD    (return) status: 0000h if successful, FFFFh on error
1Ah    WORD    socket's file handle
1Ch    WORD    0001h if socket name specified, 0000h if not
1Eh    WORD    length of socket name
20h  N BYTEs   name of socket to which to connect
---function 0009h---
18h    WORD    (return) number of bytes actually read, 0000h if connection
closed, or FFFFh on error
1Ah    WORD    socket's file handle
1Ch    WORD    number of bytes to read
1Eh    WORD    flags
20h    WORD    0000h if no source address desired
0001h if source address is to be stored (datagram sockets)
22h    WORD    length of source address
24h 110 BYTEs  source address
92h 1K BYTEs   buffer for data to be read
---function 000Ah---
18h    WORD    (return) socket's file handle or FFFFh on error
1Ah    WORD    address family (0001h,0002h)
1Ch    WORD    socket type
1Eh    WORD    protocol
---function 000Bh---
18h    WORD    (return) 0001h if ??? or FFFFh on error
1Ah    WORD    socket's file handle
1Eh    WORD    (call) ???
---function 000Ch---
18h 128 BYTEs  buffer containing ASCIZ hostname
special case if empty string or "unix"
98h    ???     'struct hostent' ???
A2h    ???     (return) ???
---function 000Dh---
18h    WORD    (return) number of bytes actually written or FFFFh on error
1Ah    WORD    socket's file handle
1Ch    WORD    number of bytes to write
1Eh    WORD    number of bytes to follow in subsequent writes???
20h    WORD    flags
22h    WORD    0000h if no destination specified, 0001h if destination present
24h    WORD    ???
26h    WORD    length of destination address
28h 110 BYTEs  destination address
96h 1K BYTEs   buffer containing data to be written
---function 000Eh---
no additional fields
---function 000Fh---
18h    DWORD   (return) DESQview task handle of calling process
---function 0010h---
18h    DWORD   (return) current time
1Ch    DWORD   (return) ???
---function 0011h---
18h    WORD    (return) status: 0000h if successful, FFFFh on error
1Ah    WORD    socket's file handle
1Ch    WORD    length of name
1Eh  N BYTEs   buffer for socket name
---function 0012h---
18h    WORD    (return) status: 0000h if successful, FFFFh on error
1Ah    WORD    socket's file handle
1Ch    WORD    maximum backlog of pending connections allowed on socket
---function 0013h---
18h    WORD    (return) file handle for new connection or FFFFh on error
1Ah    WORD    listen()ing socket's file handle
1Ch    WORD    (call) length of buffer for connecting entity's address
(return) actual length of address
1Eh  N BYTEs   buffer for connecting entity's address
---function 0014h---
18h    WORD    (return) socket's file handle or FFFFh on error
1Ah  4 BYTEs   (return) ???
1Eh    WORD    (return) ???
20h    WORD    (return) ???
22h 256 BYTEs  ASCIZ X display name
122h    ???
---function 0015h---
18h    WORD    (call) type of address??? (test for 0001h seen)
1Ah    WORD    (call) length of buffer for host address
1Ch 110 BYTEs  buffer containing host address
8Ah    WORD    (return) offset of official host name???
8Ch    WORD    (return) offset of alias list???
8Eh    WORD    (return) address type???
90h    WORD    (return) length of an address in bytes???
92h    WORD    (return) offset of address???
9Ah  N BYTEs   (return) ??? buffer for hostname, alias list, and host address
---function 0016h---
18h    ???     buffer for protocol name???
98h    ???
---function 0017h---
18h    WORD    (call) protocol number???
1Ah    WORD    (return) ??? or 0001h
---function 0018h---
18h 128 BYTEs  buffer containing ???
98h 128 BYTEs  buffer containing ???
118h    WORD    (return) ???
---function 0019h---
18h    WORD    length of name???
1Ah 128 BYTEs  buffer for name???
9Ah    WORD    (return) ???
---function 001Ah---
18h    WORD    (return) 0000h if successful, FFFFh on error
1Ah    WORD    socket's file handle
1Ch    WORD    (call) length of buffer for socket name
(return) actual length of socket name
1Eh  N BYTEs   buffer for socket name
---function 001Bh---
18h    WORD    (return) status: 0000h if successful, FFFFh on error
1Ah    WORD    socket's file handle
1Ch    WORD    (call) size of buffer for name
(return) actual size of name
1Eh  N BYTEs   buffer for peer's name
---function 001Ch---
18h    WORD    (return) status: 0000h if successful, FFFFh on error
1Ah    WORD    direction: 0000h to get, 0001h to set
1Ch    WORD    socket's file handle
1Eh    WORD    option level
20h    WORD    option name
22h    WORD    (call) length of buffer for option value
(return) actual length of option value
24h  N BYTEs   buffer for option value
---function 001Dh---
no additional fields
---function 001Eh---
18h    WORD    (return) status: 0000h ??? or 0001h ???
1Ah    WORD    file handle which may or may not be a socket
---function 001Fh---
18h    WORD    (return) file handle or FFFFh on error
1Ah    DWORD   (call) pointer to Socket Context Record (see below) of a
previously detached socket
---function 0020h---
18h    WORD    (return) status: 0000h if successful or FFFFh on error
1Ah    WORD    socket's file handle
1Ch    DWORD   (return) pointer to Socket Context Record (see below) for
the file handle
---function 0021h---
18h 64 BYTEs   buffer for DESQview startup directory (see AX=DE25h)
---function 0022h---
18h    DWORD   (return) task handle of new application
1Ch    WORD    size of .DVP data
1Eh 129 BYTEs  ASCIZ ???
9Fh  N BYTEs   .DVP data (see AX=102Ch)
---function 0023h---
18h    WORD    (return) ??? or FFFFh on error
1Ah    WORD    socket's file handle???
---function 0024h---
18h    WORD    (return) DOS error code (see INT 21/AH=59h)
0000h if successful
1Ah 129 BYTEs  ASCIZ filename/pathname
11Bh 129 BYTEs  ASCIZ canonicalized filename/pathname (see INT 21/AH=60h)
---function 0025h---
18h    WORD    value of AX
1Ah    WORD    value of BX
1Ch    WORD    (call) value of CX for call if AH value other than 12h
(call) number of stack parameters if AH value is 12h
(return) returned CX for calls other than INT 15/AH=12h
1Eh    WORD    value of DX
20h    WORD    value of DI
22h    WORD    value of SI
24h    WORD    value of DS
26h    WORD    value of ES
28h    WORD    (return) value of FLAGS after call
2Ah  N DWORDs  (call) stack parameters for INT 15/AH=12h call
(return) stack results from INT 15/AH=12h call
---function 0026h---
18h    WORD    (call) subfunction
0004h "so_exit"???
0005h "gethostbyname"
0006h "gethostname"
0009h "socket"
000Dh "gethostbyaddr"
000Fh "getprotobyname"
0010h get protocol name for protocol number
0011h "getservbyname"
0012h "getservbyport"
0013h "getsockname"???
0016h ???
0017h kill Network Manager
0018h "getpeername"???
0019h ??? (called by socket function 0000h)
001Ah ???
001Bh "so_linkup"
001Dh get network services
001Fh "getpwuid"
0020h "getpwnam"
0021h "getpwvar"
0022h "crypt"
0023h "so_unlink"
0024h "getlogin"
0028h "sethostent"
0029h "gethostent"
002Ah "soaddhost"
002Bh "soupdatehost"
002Ch "sodeletehost"
002Dh "setservent"
002Eh "getservent"
002Fh "setpwent"
0030h "getpwent"
0031h ???
0032h ???
0033h ???
0034h get IP network number
0035h ??? (pops up Network Manager window)
0037h ???
0038h get machine name and IP address
0039h ???
(return) status???
1Ah    WORD    (call) size of parameter data
(return) size of returned data
1Ch  N BYTEs   (call) parameter data required by call (see below)
(return) result data (see below)
---function 0027h---
18h    WORD    (return) status: 0000h if successful, FFFFh on error
1Ah    WORD    socket's file handle
---functions 0028h,0029h---
18h    WORD    (call) file handle for which to set priority low/high
FFFFh to change calling task's priority
---function 002Ah---
no additional fields

Format of Function 0026h/Subfunction 000Fh data:
Offset  Size    Description
00h  8 BYTEs   (return) ???

Format of Function 0026h/Subfunction 0010h data:
Offset  Size    Description
00h  2 BYTEs   (return) ???
02h    WORD    (return) protocol number
04h    WORD    (call) protocol number for which to get name
06h    WORD    (return) ???
08h    var     (return) ASCIZ protocol name
N      var     (return) ASCIZ protocol name

Format of Function 0026h/Subfunction 0011h data:
Offset  Size    Description
00h  8 BYTEs   ???
08h    var     (return) ASCIZ protocol name
var     (return) ASCIZ ??? name
var     (return) ASCIZ ??? name

Format of Function 0026h/Subfunction 0012h data:
Offset  Size    Description
00h  8 BYTEs   (return) ???

Format of Function 0026h/Subfunction 0013h data:
Offset  Size    Description
00h 116 BYTEs  (return) ???

Format of Function 0026h/Subfunction 0016h data:
Offset  Size    Description
00h  4 BYTEs   (return) ???

Format of Function 0026h/Subfunction 0018h data:
Offset  Size    Description
00h 116 BYTEs  (return) ???

Format of Function 0026h/Subfunction 0019h data:
Offset  Size    Description
00h  4 BYTEs   (return) ???
04h    DWORD   (return) task handle of ???

Format of Function 0026h/Subfunction 001Ah data:
Offset  Size    Description
00h 38 BYTEs   (return) ???

Format of Function 0026h/Subfunction 001Bh data:
Offset  Size    Description
00h 10 BYTEs   (return) ???

Format of Function 0026h/Subfunction 001Dh return data [array]:
Offset  Size    Description
00h    WORD    ??? or FFFFh if end of array
02h  7 BYTEs   ???
09h 27 BYTEs   ASCIZ name of service

Format of Function 0026h/Subfunction 0024h return data:
Offset  Size    Description
00h    var     ASCIZ username

Format of Function 0026h/Subfunction 0030h data:
Offset  Size    Description
00h    WORD    (call) UID or 0000h for current user
(return) ???
02h    WORD    (return) UID
04h  6 BYTEs   (return) ???
0Ah    var     (return) ASCIZ username
var     (return) ASCIZ encrypted password
var     (return) ASCIZ initial ("home") directory

Format of Function 0026h/Subfunction 0034h data:
Offset  Size    Description
00h  1-3 BYTEs IP network number of caller's machine (low byte first)

Format of Function 0026h/Subfunction 0038h return data:
Offset  Size    Description
00h    BYTE    ???
01h  4 BYTEs   IP address
05h    var     ASCIZ machine name
???

Values for error code:
0000h successful
0009h "BADF" bad file handle
000Ch "ENOMEM" out of memory
000Eh "EFAULT" bad address
0016h "EINVAL" invalid argument
0018h "EMFILE" too many open files
0020h "EPIPE" ??? broken pipe
0023h "EWOULDBLOCK" operation cannot be completed at this time
0024h "EINPROGRESS" operation now in progress
0026h "ENOTSOCK" socket invalid
0028h "EMSGSIZE" message too long to send atomically
002Ch "ESOCKTNOSUPPORT" socket type not supported
002Fh "EAFNOSUPPORT" address family not supp. by protocol fam.
0031h "EDOM" argument too large
0038h "EISCONN" socket is already connected
0039h "ENOTCONN" socket is not connected

Format of Socket Context Record:
Offset  Size    Description
00h    DWORD   pointer to next Socket Context Record, 0000h:0000h if last
04h    WORD    SFT index for socket, 00FFh if not connected, FFFFh if detached
06h    WORD    PSP segment of owner or 0000h
08h    WORD    mapping context of owning window
0Ah  2 BYTEs   ???
0Ch    WORD    address family
0Eh    WORD    socket type
10h    WORD    protocol
12h    WORD    socket state
0001h created
0002h bound
0003h listening???
0005h connected
14h    DWORD   timer object handle
18h    DWORD   object handle (mailbox???)
1Ch    DWORD   object handle of parent of above object or 0000h:0000h
20h    DWORD   pointer to ??? or 0000h
24h  6 BYTEs   ???
2Ah    WORD    file handle for socket or FFFFh
2Ch  2 BYTEs   ???
2Eh    WORD    nonzero if socket nonblocking
---network connections only---
30h  2 BYTEs   ???
32h    WORD    ???
34h  4 BYTEs   IP address of remote (big-endian)
38h  6 BYTEs   ???

See also: 15DE2D

15DE2E - DESQview v2.50+ - SOCKET API