ENDTCPCNN (End TCP/IP Connection)

ENDTCPCNN Command syntax diagram

 

Purpose

The End TCP/IP Connection (ENDTCPCNN) command is used to end a Transmission Control Protocol/Internet Protocol (TCP/IP) connection. This command ends a connection immediately and should be used only when a normal end is not possible.

Note: The ENDTCPCNN command is usually used by specifying option 4 on the Work with TCP/IP Connection Status list of the WRKTCPSTS (NETSTAT) display. The ENDTCPCNN command is provided as a separate command to give system administrators control over this function. By limiting the authority to the ENDTCPCNN command, the system administrator limits which users can end TCP/IP connections without restricting access to the NETSTAT utility.

 

Required Parameters

PROTOCOL
Specifies the protocol used by the connection that is to be ended. The protocol value must be either *TCP or *UDP.

*UDP: The connection was created for use with the User Datagram Protocol (UDP).

*TCP: The connection was created for use with the Transmission Control Protocol (TCP).

LCLINTNETA
Specifies the local internet address of the connection to end. This parameter is required for both UDP and TCP.

*: The local internet address was left unspecified when this connection was opened.

local-internet-address: Specify the local internet address. The internet address is specified in the form nnn.nnn.nnn.nnn, where nnn is a decimal number ranging from 0 through 255. An internet address is not valid if it has a value of all binary ones or all binary zeros for the network identifier (ID) portion or the host ID portion of the address. If the internet address is entered from a command line, the address must be enclosed in apostrophes.

LCLPORT
Specifies the local port number of the connection to end. This parameter is required for both UDP and TCP. A decimal number identifying a local port must always be specified for this command.

local-port: Specify the local port number of the connection to end. Valid values range from 1 through 65535.

Attention:

Ports 1 through 1024 are reserved for use by system-supplied TCP/IP applications. If the user specifies ports 1 through 1024, it can affect the operation of those applications.

 

Optional Parameters

RMTINTNETA
Specifies the remote internet address of the connection to end. This parameter is required for TCP.

*: The remote internet address was left unspecified when this connection was opened.

remote-internet-address: Specify the remote internet address. The internet address is specified in the form nnn.nnn.nnn.nnn, where nnn is a decimal number ranging from 0 through 255. An internet address is not valid if it has a value of all binary ones or all binary zeros for the network identifier (ID) portion or the host ID portion of the address. If the internet address is entered from a command line, the address must be enclosed in apostrophes.

RMTPORT
Specifies the remote port number of the connection to end.

This parameter is required for TCP.

*: The remote port number was left unspecified when this connection was opened.

remote-port: Specify the remote port number of the connection to end.

Examples for ENDTCPCNN

Example 1: Ending a TCP Connection

ENDTCPCNN PROTOCOL(*TCP)
  LCLINTNETA('9.5.1.109') LCLPORT(13054)
  RMTINTNETA('9.130.28.144') RMTPORT(23)

This command ends the TCP connection between local port 13054 for local internet address 9.5.1.109 and remote port 23 for remote internet address 9.130.28.144. The TCP/IP protocol stack ends all activity on the connection and returns the resources to the free storage pools.

Example 2: Closing a UDP Socket

ENDTCPCNN PROTOCOL(*UDP)
  LCLINTNETA('9.130.28.144') LCLPORT(596)

This command closes the UDP socket using local port 596 and local internet address 9.130.28.144. The TCP/IP protocol stack ends all activity on the connection and returns the resources to the free storage pools.

Example 3: Ending a LISTEN State TCP Socket

ENDTCPCNN PROTOCOL(*TCP)
  LCLINTNETA(*) LCLPORT(5023)
  RMTINTNETA(*) RMTPORT(*)

This command ends the TCP socket that is listening on local port 5023. The application that created this socket did not specify a local internet address. The socket is closed and the local port is made available for use by another application.

Error messages for ENDTCPCNN

*ESCAPE Messages

TCP2670
Not able to complete request. TCP/IP services are not available.
TCP3B01
Not able to end TCP connection &3 &4, &5 &6.
TCP3B02
Not able to close UDP socket &3 &4.
TCP9999
Internal system error in program &1.