Version 1.0 of the API should be considered an alpha. Code is complete except for
the TRANSLATE and SELECT functions, except as noted below. However some functions and options
have not been completely tested. I developed REXXSOCKVM to support another project
and wanted to release the alpha version pending further work. Bug reports,
especially if accompanied by a fix, are welcomed. Please report bugs to:
the author.
To use RXSOCKVM do the following:
- Copy rxsockvm.dll to a directory in your libpath.
- Insert the initialization/termination code in your Rexx program.
All RXSOCKVM calls have a common format:
ret = Socket( <command> [, <parameters>...] )
where different commands take a variable number of parameters as indicated.
the returned value ('ret' in the above example) will contain either:
- A return code of "0" optionally followed by additional data as described for
each command below.
- A non-zero return code followed by an error acronym and a descriptive error
message.
RXSOCKVM Calls:
(case is insignificant in parameters,
[] indicates optional parameter, | indicates alternatives)
ret = Socket( 'Accept', socketid )
| socketid is a socket number as returned by the Socket( 'Socket' ... ) call
|
ret = Socket( 'Close', socketid )
|
ret = Socket( 'Connect', socketid, socketname )
| socketname is a socket's network address consting of domain port ID and IP address.
example: "AF_INET 1234 1.2.3.4"
ret = Socket( 'Fcntl', socketid, 'F_GETFL' )
| ret = Socket( 'Fcntl', socketid, 'F_SETFL', fvalue )
| fvalue can be 'NON-BLOCKING' or 'FNDELAY' or 'BLOCKING' or '0'
| ret = Socket( 'GetClientId' [, domain] )
| domain can be 'AF_INET' or '0'
| ret = Socket( 'GetDomainName' )
| ret = Socket( 'GetHostByAddr' [, ipaddress] )
| ipaddress can be 'INADDR_ANY' or 'ANY' or 'INADDR_BROADCAST' or 'BROADCAST'
or an IP address in dotted-decimal notation
ret = Socket( 'GetHostByName' [, hostname | fullhostname] )
| hostname is the host processor name as a character string.
fullhostname is the fully qualified host name.
ret = Socket( 'GetHostId' )
| ret = Socket( 'GetHostName' )
| ret = Socket( 'GetPeerName', socketid )
| ret = Socket( 'GetProtoByName', protocolname )
| Protocolname is the name of a protocol: 'IP', 'TCP' or 'UDP'.
| ret = Socket( 'GetProtoByNumber', protocolnumber )
| ret = Socket( 'GetServByName', servicename [, protocolname] )
| servicename> is the name of a service such as 'TELNET'.
| ret = Socket( 'GetServByPort', portid [, protocolname] )
| portid is a port number, 'INPORT_ANY' or 'ANY'.
| ret = Socket( 'GetSockOpt', socketid, level, optname )
|
level is 'SOL_SOCKET'.
| optname is one of the following:
'SO_ASCII' | 'SO_BROADCAST' | 'SO_DEBUG'
| 'SO_EBCDIC' | 'SO_ERROR' | 'SO_KEEPALIVE'
| 'SO_LINGER' | SO_OOBINLINE' | 'SO_SNDBUF'
| 'SO_REUSEADDR' | 'SE_TYPE'
|
|
| ret = Socket( 'GiveSocket', socketid, clientid )
| Not supported by OS/2 TCP/IP.
| ret = Socket( 'Initialize', subtaskid [, 40|maxdesc [ TCP/IP userid] ] )
|
subtaskid is the name of the "socket set", 1-8 characters.
RXSOCKVM allows only one active socket set.
maxdesc is the number of sockets in the "socket set".
| TCP/IP userid is ignored.
| |
| ret = Socket( 'ioctl', socketid, icmd [, ivalue ] )
| icmd is one of the following:
| ret = Socket( 'Listen', socketid [, 10|backlog ])
| backlog is the number of pending connection requests.
| ret = Socket( 'Read', socketid [, 10000|maxlength ] )
| maxlength is the maximum length of data to be read
| ret = Socket( 'Recv', socketid [, 10000|maxlength [, recvflags] ] )
| recvflags is 'MSG_OOB' or 'OOB' or 'OUT_OF_BAND'
and/or 'MSG_PEEK' or 'PEEK'.
ret = Socket( 'RecvFrom', socketid [, 10000|maxlength [, recvflags] ] )
| ret = Socket( 'Resolve', ipaddress|hostname|fullhostname [, timeout ] )
| timeout is a positive integer indicating
the maximum wait time in sec.
ret = Socket( 'Select', [, mask [, 'FOREVER'|timeout ] )
| mask is:
'Read' socketlist
| 'Write' socketlist
| 'Exception' socketlist
| socketlist is a list of socketids
| 'Read', 'Write', and 'Exception' can be in any order.
|
| ret = Socket( 'Send', socketid , data [, sendflags ] )
|
data is the message string to be sent.
| sendflags are 'MSG_OOB' or 'OOB' or 'OUT_OF_BAND'
| and/or 'MSG_DONTROUTE' or 'DONTROUTE'
|
| ret = Socket( 'SendTo', socketid , data [, sendflags [, destination name ] ] )
| destination name is the destination network address.
| ret = Socket( 'SetSockOpt', socketid, level, optname, optvalue )
| optname - see 'GetSockOpt'
| ret = Socket( 'Shutdown', socketid [, 'BOTH'|how ] )
| how is 'FROM' or 'RECEIVE' or 'RECEIVING' or 'READ' or 'READING'
or 'TO' or 'SEND' or 'SENDING' or 'WRITE' or 'WRITING'
ret = Socket( 'Socket' [, 'AF_INET' [, 'SOCK_STREAM'|'SEOC_DGRAM'|'SOCK_RAW'|'RAW'
[, 'IPPROTO_TCP'|'IPPROTO_UDP' ] ] ] )
| ret = Socket( 'SocketSetList' )
| ret = Socket( 'SocketSetStatus' [, subtaskid ] )
| ret = Socket( 'TakeSocket', clientid, socketid )
| Not supported by OS/2 TCP/IP.
| ret = Socket( 'Terminate' [, subtaskid ] )
| ret = Socket( 'Trace' [, setting [, modifier ] ] )
| Not supported by OS/2 TCP/IP.
| ret = Socket( 'Translate', string, how )
| Not implemented by this version of RXSOCKVM.
| ret = Socket( 'Version' )
| ret = Socket( 'Write', socketid,data )
| | | | | | |
Returned values:
(if other than 0)
'Accept'
| "0 socketid socketname" as "0 8 AF_INET 1234 19.8.7.6"
|
'Fcntl'
| if 'F_GETFL' is specified returns "0 characteristic"
|
'GetClientId'
| "0 AF_INET Userid subtaskid".
|
'GetDomainName'
| "0 domain_name".
|
'GetHostByAddr'
| "0 fully-qualified_host_name".
|
'GetHostByName'
| "0 ip_address".
|
'GetHostId'
| "0 ip_address".
|
'GetHostName'
| "0 host_name".
|
'GetPeerName'
| "0 socket_name".("domain portid ipaddress")
|
'GetProtoByName'
| "0 protocol_number". (e.g. 'TCP'->6).
|
'GetProtoByNumber'
| "0 protocol_name". (e.g. 6->'TCP').
|
'GetServByName'
| "0 servicename portid protocolname".
|
'GetServByPort'
| "0 the domain_name".
|
'GetSockName'
| "0 socket_name". ("domain portid ipaddress").
|
'GetSockOpt'
| "0 option_status".
|
'Initialize'
| "0 subtaskid numberofsockets 'TCPIP' "
|
'Ioctl'
| "0 operating_characteristics".
|
'Read'
| "0 length_of_data_read + data".
|
'Recv'
| "0 length_of_data_read + data".
|
'RecvFrom'
| "0 network_address length_of_data_read data".
|
'Select'
| "0 number_of_seckets socket_list".
socket_list example" "Read 1 2 Write 3 Exception"
'Send'
| "0 length_of_data_written".
| 'SendTo'
| "0 length_of_data_written".
| 'Socket'
| "0 new_socket_id".
| 'SocketSet'
| "0 subtaskid".
| 'SocketSetList'
| "0 subtaskid".
RXSOCKVM allows only one socket set.
'SocketSetStatus'
| "0 subtaskid 'Connected' 'Free' # 'Used' #".
| 'Translate'
| "0 length_of_translated_string translated_string".
| 'Version'
| "0 'RxSockVM 1.00 14 July 2000'"
| 'Write'
| "0 length_of_data_written".
| | |
Initialization/Termination code for RXSOCKVM
/* Required initialization code */
RC = RxFuncAdd( 'Socket', 'RXSOCKVM', 'Socket' )
If RC<>0 Then Do
Say "RxFuncAdd for RXSOCKVM returned" RC
End
/* Suggested initialization code to make sure */
/* that DLL is released after use */
Signal On Error Name Cleanup
Signal On Failure Name Cleanup
Signal On Halt Name Cleanup
Signal On Syntax Name Cleanup
... Your code goes here ...
/* Required Termination code */
/* Prior to this you might also want to execute */
/* some application-specific cleanup: close, etc */
Cleanup:
RC = RxFuncDrop( 'Socket' )
Rebuilding RXSOCKVM
RXSOCKVM was compiled using EMX 0.9d and EMX sockets.
It also requires base OS/2 TCP/IP support.
To rebuild the dll, cd to the directory containg the sources
and issue the command
make -f rxsockvm.mak
The rebuilt dll should replace the original in whatever directory
you placed it at install time. You will most likely have to end
all instances of usage before copying.