Instance methods
getHostByAddr: aString
Answers the representation of the hostEnt structure for the specified address.
aString:
A host address32 bit in network order.
The getHostByAddr: operation returns an instance of SciHostEnt which is a representation of the hostEnt structure for the specified address retrieved from the platform.
The getHostByAddr: operation is unsuccessful if any of the following errors occur: ENOTINITIALISED, ENETDOWN, EINTR, ENODATA, EHOSTNOTFOUND. For detailed information on these errors, see Error values.
getHostByName: hostName
Answers the representation of the hostent structure for the specified host.
hostName
A host name.
Special note for multihomed computers: A computer is multihomed when more that one network interface card is installed, and/or when a Virtual Private Network interface (VPN) is active. If hostName is the name of the local computer and the local computer is multihomed, the hostent structure will contain multiple entries in the addrList instance variable. The addresses are stored in host order, but be aware that the order is not always predictable. For example, when VPN sessions are established, they often insert their address at the beginning of the host order list. Consumers of this method typically pull the first address from the addrList and this may not be the desired result.
The getHostByName: operation is unsuccessful if any of the following errors occur: ENOTINITIALISED, ENETDOWN, EINTR, ENODATA, EHOSTNOTFOUND. For detailed information on these errors, see Error values.
getHostBySockName: aSocketAddress
Answers the representation of the hostEnt structure for the specified address.
aSocketAddress:
An instance of SciSocketAddress with a valid address, port and family.
getHostName
Answers the standard host name (hostEnt) for the local machine.
The getHostName operation returns a String retrieved from the platform that contains the standard host name for the local machine.
The getHostName operation is unsuccessful if any of the following errors occur: ENOTINITIALISED, ENETDOWN, EFAULT. For detailed information on these errors, see Error values.
getProtoByName: aProtoName
Answers the protocol information corresponding to the protocol name
aProtoName
A protocol name.
The getProtoByName: operation returns an instance of SciProtoEnt which represents the protoent structure returned by the platform. This structure contains the official name of the protocol, the alternate names of the protocol and the protocol number.
The getProtoByName: operation is unsuccessful if any of the following errors occur: ENOTINITIALISED, ENETDOWN, EINTR, ENODATA. For detailed information on these errors, see Error values.
getProtoByNumber: aProtoNumber
Answers the protocol information corresponding to the protocol number.
aProtoNumber
A protocol number
The getProtoByNumber: operation returns an instance of SciProtoEnt which represents the protoent structure returned by the platform. This structure contains the official name of the protocol, the alternate names of the protocol and the protocol number.
The getProtoByNumber: operation is unsuccessful if any of the following errors occur: ENOTINITIALISED, ENETDOWN, EINTR, ENODATA. For detailed information on these errors, see Error values.
getServByName: serviceName protocol: protocolName
Answers the service information corresponding to the service name and protocol.
serviceName
A service name.
protocolName
A protocol name or nil.
The getServByName: operation returns an instance of SciServEnt which represents the servent structure returned by the platform. This structure contains the official name of the service, the alternate names of the service, the port number at which the service is located and the name of the protocol to use with the service.
If the protocol parameter is nil the first service found is returned.
The getServByName: operation is unsuccessful if any of the following errors occur: ENOTINITIALISED, ENETDOWN, EINTR, ENODATA. For detailed information on these errors, see Error values.
getServByPort: port protocol: protocolName
Answers the service information (SciServEnt) corresponding to the service port number and protocol.
port
A port number.
protocolName
A protocol name or nil.
The getServByPort: operation returns an instance of SciServEnt which represents the servent structure returned by the platform. This structure contains the official name of the service, the alternate names of the service, the port number at which the service is located and the name of the protocol to use with the service.
The getServByPort: operation is unsuccessful if any of the following errors occur: ENOTINITIALISED, ENETDOWN, EINTR, ENODATA. For detailed information on these errors, see Error values.
ping: portString at: hostnameString
Answers a string representation of the SciSocketAddress of the pinged host or an error string.
portString
The port number at which to ping the host.
hostnameString
The name of the host to ping.
The ping:at: operation is a TCP ping utility. It can also be invoked via the String>>sciPing method as in the following example...
'www.ibm.com:80' sciPing
selectRead: readCollection write: writeCollection except: exceptionCollection timeout: timeout
Answers a SciResult that contain socket collections (orderedCollections) that are ready for attention.
The select operation examines the sockets in the readCollection, writeCollection, and exceptionCollection to see if any of these sockets are ready for reading, ready for writing, or have an exception condition pending respectively.
readCollection
A collection of sockets to check for read ready.
writeCollection
A collection of sockets to check for write ready.
exceptionCollection
A collection of sockets to check for exceptions.
timeout
The timeout interval, 0 for non-blocking, nil for pure blocking.
The parameter timeout specifies a maximum interval in microseconds to wait for the select operation to complete.
The readCollection, writeCollection, and exceptionCollection can be any ordered collection. This method answers a SciResult, which can be queried for the resulting ordered collections with the selectors readCollection, writeCollection, and exceptionCollection.
The operation will block for up to the timeout (Integer) period or until one of the sockets in at least one of the sets becomes ready or has an exception pending. If timeout is set to 0 the operation returns immediately. If timeout is set to nil, the operation blocks until at least one of the descriptors meets the specified criteria. The select operation blocks the current Smalltalk process.
Selecting read ready on a socket upon which a listen call has been performed will indicate that a subsequent accept call on that socket will not block.
The selectRead: operation is unsucessful if any of the following errors occur: ENOTINITIALISED, ENETDOWN, EBADF, ENOTSOCK, EINTR, EINVAL, EINPROGRESS. For detailed information on these errors, see Error values.
socket: aFamily type: aType protocol: aProtocol
Answer a new instance of a socket.
aFamily
The currently support values are AFINET and AFLOCAL (AFUNIX).
aType
The currently supported options are: SOCKSTREAM and SOCKDGRAM
aProtocol
The only currently supported option is IP. This parameter sets the default protocol, which is automatically determined based on aFamily and aType:
aFamily AFINET & aType SOCKSTREAM ==> aProtocol TCP
aFamily AFINET & aType SOCKDGRAM ==> aProtocol UDP
aFamily AFLOCAL & aType SOCKSTREAM ==> aProtocol TCP
aFamily AFLOCAL & aType SOCKDGRAM ==> aProtocol UDP
For Linux (UNIX):
socketpair: type Answers a colection containing a pair of local sockets that are connected together.
type
Type can be SOCKSTREAM or SOCKDGRAM.
For example, to create a pair of connected local stream sockets, call
SciSocketManager default
socketpair: SciSocketConstants::SOCKSTREAM.
A collection containing a pair of connected local stream sockets will be returned ready for use.
Available only on Linux/Unix platforms.
To help with debugging problems when using the TCP/IP communication protocol, a tracing capability at the socket API level for the platform Smalltalk is running on has been added. The following show how to turn on and off the trace from Smalltalk.
traceEnd
Turn off TCP/IP Trace.
 
SciSocketManager default traceEnd.
traceFilename: traceFileNameString
Set the name of the file for the TCP/IP sci trace. The Default is 'sciTrace.log'.
traceFileNameString
Name of file to hold log entries.
 
SciSocketManager default traceFilename: 'MyTrace.log'.
traceStart
Start trace of sci platform functions (Level 1).
 
SciSocketManager default traceStart.
traceStartAtLevel: anInteger
Start trace of platform functions at level specified.
anInteger
Level 1 = API Trace. (default)
Level 2 = Level 1 trace plus Send and Receive Data Trace.
Level 2 captures TCP/IP API Trace plus a trace of the first 256 bytes of data for a Send and Receive.
 
SciSocketManager default traceStartAtLevel: 2.
Last modified date: 05/11/2020