Netstat DRop/-D command
You can terminate a specific TCP/IP socket endpoint using the Netstat DRop/-D command.
When a DRop command is issued against a socket endpoint, any outstanding or following socket calls that refer to the socket that is being dropped terminate with a negative return code.
The socket endpoint that you drop can be a listening TCP server socket endpoint, a fully connected TCP socket (either server or client connection endpoint), or a UDP socket endpoint. When you drop a TCP connection or UDP endpoint, the associated socket does not close. The application that owns the associated socket is responsible for closing the socket.
The DRop/-D command terminates the socket endpoint that is identified by the connection number n. You can determine the connection number from the Conn column in the Netstat COnn/-c or Netstat TELnet/-t display.
You can use this parameter only if the MVS™.VARY.TCPIP.DROP security product resource is defined and the user ID that is associated with the DROP command is permitted to this resource.
Use the DRop/-D command to terminate an individual TCP connection when you do not want to terminate the server itself, but want only to drop an individual connection with that server.
Use the DROP/-D command to terminate old TCP connections if they prevent a server from being restarted. This is sometimes necessary when the server does not enable the SO_REUSEADDR socket option before binding to its well-known port.
If you want to terminate all socket activity from a specific sockets application, terminate the application using the appropriate mechanism that is provided by the application. The DRop/-D command can have unpredictable results when issued against a listening socket or UDP socket. Some applications might not handle the subsequent socket errors as expected.
Restriction: The Netstat DRop/-D command supports dropping only one TCP connection per command invocation. The VARY TCPIP,,DROP command provides the ability to drop all TCP connections that are associated with a server. See VARY TCPIP,,DROP for more information.
z/OS UNIX syntax
- TCp/-p tcpname
- Executes the command against a specific TCP/IP address space. The tcpname is an 8-byte procedure name that is used to start the TCP/IP. When the S member.identifier method of starting TCP/IP is used, the value specified for identifier must be used as tcpname.
- n
- The connection number that is a unique number assigned by the TCP/IP stack to uniquely identify a socket entity.
Command syntax examples
From TSO environment
NETSTAT DROP n
Drop the connection n from the default TCP/IP stack.
NETSTAT DROP m TCP TCPCS6
Drop the connection m from TCPCS6 stack.
From UNIX shell environment
netstat -D n
netstat -D m -p tcpcs6
Report examples
The following examples are generated by using TSO NETSTAT command. Using the z/OS UNIX netstat command displays the data in the same format as the TSO NETSTAT command.
NETSTAT CONN
MVS TCP/IP NETSTAT CS V2R2 TCPIP NAME: TCPCS 17:40:36
User Id Conn Local Socket Foreign Socket State
------- ---- ------------ -------------- -----
PORTMP3 00010035 0.0.0.0..2220 0.0.0.0..0 Listen
TSUSER1 00010020 0.0.0.0..1027 0.0.0.0..0 Listen
TSUERS2 00010043 127.0.0.1..1033 127.0.0.1..23 Establsh
PORTMP3 00021002 0.0.0.0..2221 *..* UDP
NETSTAT DROP 10035
Connection successfully dropped
NETSTAT CONN
MVS TCP/IP NETSTAT CS V2R2 TCPIP NAME: TCPCS 17:40:39
User Id Conn Local Socket Foreign Socket State
------- ---- ------------ -------------- -----
TSUSER1 00010020 0.0.0.0..1027 0.0.0.0..0 Listen
TSUERS2 00010043 127.0.0.1..1033 127.0.0.1..23 Establsh
PORTMP3 00021002 0.0.0.0..2221 *..* UDP