Class Reference
IRIS for UNIX 2019.4
InterSystems: The power behind what matters   
Documentation  Search
  [%SYS] >  [%SYSTEM] >  [TCPDevice]
Private  Storage   

class %SYSTEM.TCPDevice extends Help

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.

Inventory

Parameters Properties Methods Queries Indices ForeignKeys Triggers
7


Summary

Methods
GetDisconnectCode Help LocalAddr LocalAddrPort
LocalPort PeerAddr PeerAddrPort PeerPort


Methods

• 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.
• 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).
• 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.
• 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.
• 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.
• 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.
• 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.


Copyright (c) 2019 by InterSystems Corporation. Cambridge, Massachusetts, U.S.A. All rights reserved. Confidential property of InterSystems Corporation.