Class Reference
Cache for UNIX 2018.1.3
InterSystems: The power behind what matters   
Documentation  Search
Private  Storage  

abstract class %IO.SocketCommon

Common class members to both Socket and ServerSocket

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
12 7


Summary

Properties
AtEnd DisconnectHandler InputBufferSize KeepAliveInterval
LineTerminator LocalInterface OutputBufferSize Port
Remote SSLConfig TCPReceiveBuffer TCPSendBuffer

Methods
Flush GetLocalInterfaces Read ReadAny
ReadLine Write WriteLine

Subclasses
%IO.ServerSocket %IO.Socket

Properties

• property AtEnd as %Boolean [ InitialExpression = 0,ReadOnly ];
Override InitialExpression
• property DisconnectHandler as %RegisteredObject;
Object on which to call OnDisconnect() when a connection is lost
• property InputBufferSize as %Integer [ InitialExpression = 32767 ];
• property KeepAliveInterval as %Integer(MAXVAL=432000,MINVAL=-1) [ InitialExpression = 0 ];
Connection-specific TCP keepalive interval in seconds. A setting of -1 means KeepAlive should be disabled entirely. Cache supports per socket keepalive on Windows and Linux, so this setting is ignored on other platforms. The default value of 0 will use the current system-wide TCP keepalive interval. Valid settings are -1, to disable keepalive entirely, and between 0 seconds and 432000 seconds (5 days), where positive values less than 30 will be treated as a 30 second interval.
• property LineTerminator as %String(TRUNCATE=1) [ InitialExpression = $Char(10) ];
Override InitialExpression
• property LocalInterface as %String;
In a multi-homed system, specify which local network interface the TCP connection should go through. An empty value means use any interface. See GetLocalInterfaces() to enumerate available choices.
• property OutputBufferSize as %Integer [ InitialExpression = 32767 ];
• property Port as %String(MAXLEN=6,TRUNCATE=1);
• property Remote as %String [ ReadOnly ];
The IP address and port of the remote end of the socket connection Time and IP address and port (and disconnect time) of the last connected remote socket
• property SSLConfig as %String;
The name of an existing SSL/TLS system configuration set to use (Secure Socket Layer / Transport Layer Security, configured via the system portal's Security Management page). May include a certificate password after a '|' character for inbound connections.
• property TCPReceiveBuffer as %Integer(MINVAL=0) [ InitialExpression = 0 ];
Control the size, in bytes, of the TCP Receive Buffer (SO_RCVBUF) for the TCP device. This should be used in conjunction with TCPSendBuffer to increase the TCP window as per RFC1323. The primary use case is in situations with high latency or bandwidth, where the default sizes of the respective buffers may constrain throughput. The default value of 0 will use the OS default setting.
• property TCPSendBuffer as %Integer(MINVAL=0) [ InitialExpression = 0 ];
Control the size, in bytes, of the TCP Send Buffer (SO_SNDBUF) for the TCP device. This should be used in conjunction with TCPReceiveBuffer to increase the TCP window as per RFC1323. The primary use case is in situations with high latency or bandwidth, where the default sizes of the respective buffers may constrain throughput. The default value of 0 will use the OS default setting.

Methods

• method Flush(Output pSC As %Status)
Ensure that any data already written to the TCP buffer are actually sent to the remote partner.
• classmethod GetLocalInterfaces(Output pResults) as %Status
Get a list of link-local interface addresses The output argument is an integer-subscripted array of local interface IP addresses. They may be IPv4 or IPv6 addresses. On LINUX systems the address will be suffixed with the name of the interface (e.g. %eth0).

After the IP address each list entry contains a space followed by, in parentheses, the text "IPv4" or "IPv6" depending on the type of interface, a space, and then the full name of the interface.

This entry may be set directly into the LocalInterface property of this class but only the IP address portion will be used in the binding of the socket to local network interfaces.

To be able to bind to IPv6 interfaces you may need to enable IPv6. This is done in the Management Portal by going to System Administration / Configuration / Additional Settings / Startup and editing the IPv6 setting.

• method Read(pMaxReadLen As %Integer, ByRef pTimeout As %Numeric = -1, Output pSC As %Status) as %String
Read until pMaxReadLen chars are gotten or pTimeout expires. On return, if pTimeout=0 it means no timeout occurred and the returned string contains the full pMaxReadLen characters. If pTimeout is unchanged it means the full timeout period expired before encountering pMaxReadLen chars and the returned string is shorter than pMaxReadLen.
• method ReadAny(pMaxReadLen As %Integer, ByRef pTimeout As %Numeric = -1, Output pSC As %Status) as %String
Return as soon as any data arrives, or timeout expires, or MaxReadLen is reached
• method ReadLine(pMaxReadLen As %Integer, ByRef pTimeout=-1, Output pSC As %Status, ByRef pLineTerminator As %String = ..LineTerminator) as %String
Read until pMaxReadLen chars are gotten, pTimeout expires, or a LineTerminator character is encountered. On return, if pTimeout=0 it means no timeout occurred. If pTimeout=0 and the returned string contains the full pMaxReadLen characters, it means no LineTerminator was encountered yet, even if the following character would be a LineTerminator. If pTimeout=0 and the returned string is shorter than pMaxReadLen, then a LineTerminator was encountered. If pTimeout is unchanged it means the full timeout period expired before encountering a LineTerminator character or pMaxReadLen chars and the returned string is shorter than pMaxReadLen. On return, pLineTerminator contains the encountered LineTerminator character(s) if any.
• method Write(pData As %String = "", pFlush As %Boolean, Output pSC As %Status)
Write pLine to the stream buffer, followed by the current LineTerminator characters. If pFlush is True, ensure that the characters are actually sent to the stream.
• method WriteLine(pLine As %String = "", pFlush As %Boolean, Output pSC As %Status)


Copyright © 1997-2019, InterSystems Corporation