End TCP/IP Connection (ENDTCPCNN)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

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.

Top

Parameters

Keyword Description Choices Notes
PROTOCOL Protocol *UDP, *TCP Required, Positional 1
LCLINTNETA Local internet address Character value, * Required, Positional 2
LCLPORT Local port 1-65535 Required, Positional 3
RMTINTNETA Remote internet address Character value, * Optional, Positional 4
RMTPORT Remote port 1-65535, * Optional, Positional 5
Top

Protocol (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).
Top

Local internet address (LCLINTNETA)

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

*
The remote port number was left unspecified when this connection was opened.
character-value
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.
Top

Local port (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.

1-65535
Specify the local port number of the connection to end.

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.

Top

Remote internet address (RMTINTNETA)

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

*
The remote port number was left unspecified when this connection was opened.
character-value
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.
Top

Remote port (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.
1-65535
Specify the remote port number of the connection to end.
Top

Examples

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.

Top

Error messages

*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.
Top