%SYSTEM.TCPDevice
Class %SYSTEM.TCPDevice Extends Help [ System = 4 ]
The %SYSTEM.TCPDevice class provides an interface for retrieving IP address and port of current TCP device.
These interfaces support both IPV6 and IPV4 internet addresses.
Methods
GetDisconnectCode
ClassMethod GetDisconnectCode() As %Integer
Get the O/S error that caused a or error due to peer disconnect or network error on a TCP device.
The $IO must be a TCP device or $system.TCPDevice.GetDisconnectCode() generates a error.
The error returned will be 0 if the peer closed the TCP connection.
LocalAddr
ClassMethod LocalAddr(Format As %Integer = 0) As %String
Get local IP address of current TCP device.
Parameters:
Format - The format of address to be returned. If this argument is omitted the default value is 0. The value could be:
- 0: in text format, 'dotted' decimal string for IPV4, colon-hex address string for IPV6.
- 1: in binary format, 4 character length for IPV4, 16 characters for IPV6.
Return:
Returns the local IP address associated with the TCP device. It could be in binary or text format depends on the Format parameter. For binary format the IP address is in Network order.
If the current device ($IO) is not a TCP device, it gets error.
If the TCP device is in 'listening' state, the IP address would be all zeros (INADDR_ANY).
LocalAddrPort
ClassMethod LocalAddrPort(Addr As %String) As %String
Get local IP address and port number of current TCP device.
Parameters:
Format - The format of address to be returned. If this argument is omitted the default value is 0. The value could be:
- 0: in text format, 'dotted' decimal string for IPV4, colon-hex address string for IPV6.
- 1: in binary format, 4 character length for IPV4, 16 characters for IPV6.
Return:
Returns the local IP address and port number associated with the TCP device. The IP address could be in binary or text format depends on the Format parameter. For binary format the IP address is in Network order.
If the current device ($IO) is not a TCP device, it gets error.
If the TCP device is in 'listening' state, the IP address would be all zeros (INADDR_ANY).
The return string is a List string with IP address in first and port number in second element.
The port number is a numberic string in Host order.
LocalPort
ClassMethod LocalPort() As %String
Get local port number of current TCP device.
Return:
Returns the local port number associated with the TCP device. If the current device ($IO) is not a TCP device, it gets error.
The port number is a numberic string in Host order.
PeerAddr
ClassMethod PeerAddr(Format As %Integer = 0) As %String
Get foreign IP address of current TCP device.
Parameters:
Format - The format of address to be returned. If this argument is omitted the default value is 0. The value could be:
- 0: in text format, 'dotted' decimal string for IPV4, colon-hex address string for IPV6.
- 1: in binary format, 4 character length for IPV4, 16 characters for IPV6.
Return:
Returns the foreign IP address associated with the TCP device. It could be in binary or text format depends on the Format parameter. For binary format the IP address is in Network order.
If the current device ($IO) is not a TCP device, it gets error.
If the TCP device is in 'listening' state or not connected to remote system, it returns a null string.
PeerAddrPort
ClassMethod PeerAddrPort(Format As %Integer = 0) As %String
Get foreign IP address and port number of current TCP device.
Parameters:
Format - The format of address to be returned. If this argument is omitted the default value is 0. The value could be:
- 0: in text format, 'dotted' decimal string for IPV4, colon-hex address string for IPV6.
- 1: in binary format, 4 character length for IPV4, 16 characters for IPV6.
Return:
Returns the foreign IP address and port number associated with the TCP device. The IP address could be in binary or text format depends on the Format parameter. For binary format the IP address is in Network order.
If the current device ($IO) is not a TCP device, it gets error.
If the TCP device is in 'listening' state or not connected to remote system, it returns a null string.
The return string is a List string with IP address in first and port number in second element.
The port number is a numberic string in Host order.
PeerPort
ClassMethod PeerPort() As %String
Get foreign port number of current TCP device.
Return:
Returns the foreign port number associated with the TCP device. If the current device ($IO) is not a TCP device, it gets error.
If the TCP device is in 'listening' state or not connected to remote system, it returns a null string.
The port number is a numberic string in Host order.