Sponsored Content
Operating Systems Solaris How to clear network socket port 17005? Post 302738789 by jim mcnamara on Sunday 2nd of December 2012 08:25:01 PM
Old 12-02-2012
The suggestions I have may make it better, however you cannot get rid of some wait states and still have tcp configured correctly. I am assuming it goes to TIME_WAIT.

This is a programming error - which you cannot fix. Most times programs call setsockopt() with SO_REUSEADDR so that if the program is forced to exit then the socket can be reused right away.

What you can do is to check a TCP parameter, especially if you really are waiting one half hour. You should only have to wait 4 minutes or so.
As root:

Code:
ndd -get  /dev/tcp time_wait_interval

You should get a value like 60000 (60 seconds = 60 x 1000 for this parameter).
If it is 60000 the problem lies elsewhere. Or I misunderstood what you asked.
Do NOT go below 60000.

If it is a larger number set it to 60 seconds:
Code:
ndd -set /dev/tcp tcp_time_wait_interval 60000

I am assuming this socket goes into TIME_WAIT, which lasts 2 * MSL (Max segment lifetime), we tune that with the tcp_time_wait_interval. So, I am assuming the TIME_WAIT interval TCP setting is bonked.

If the socket persists in LISTEN (not TIME_WAIT), a thread somewhere still has the socket open. You can find the pid with script below. Issue a kill command (NOT kill -9)
Code:
kill <pid>

, the socket should show TIME_WAIT and be gone in 2 minutes or so.

Run this as root:
Code:
#!/bin/ksh
pids=$(/usr/bin/ps -ef | sed 1d | awk '{print $2}')

if [ $# -eq 0 ]; then
   read ans?"Enter port you would like to know pid for: "
else
   ans=$1
fi

for f in $pids
do
   /usr/proc/bin/pfiles $f 2>/dev/null | /usr/xpg4/bin/grep -q "port: $ans"
   if [ $? -eq 0 ]; then
      echo "Port: $ans is being used by PID:\c $f"      
   fi
done

If this does not work you can consider restarting network services, but this has the almost same effect on users and programs as rebooting.

Get back to us if this doesn't help.
 

10 More Discussions You Might Find Interesting

1. Programming

socket on serial port

Does anyone know if it's possible to send socket by a serial port ? If yes, how can I find on Irix the value of my serial ports to use with this function : serverSockAddr.sin_port = ? Thanks for all responses ! Kintoo (2 Replies)
Discussion started by: kintoo
2 Replies

2. Programming

how to clear/clean mbufs (network buffer space)?

When I worked with client-server (socket) programming, I encountered "the socket error# 10055" which means "No buffer space available". This might be a symptom of one or more applications that didn't return system resources (like memory) properly. Temporary solution was to reboot the machine to... (7 Replies)
Discussion started by: dipti
7 Replies

3. UNIX for Dummies Questions & Answers

Socket programming:One server two port

I want my server socket to listen on two ports in my machine. How do i achieve it? I will have two clients one connecting to 1 port and another to a different port. So my server needs to listen to both. Thanks. (1 Reply)
Discussion started by: abc.working
1 Replies

4. Programming

Clear Serial Port Buffer Using iclear, iflush

Hello, I am having trouble clearing the serial port buffer using the iclear and iflush commands. The code runs without errors being returned, but when I check the buffer again there is still data. The only way I have so far is to read until there is nothing left in the buffer. Shouldn't one... (1 Reply)
Discussion started by: sammy-e
1 Replies

5. IP Networking

Port number of socket returned by accept()

Hi, I typed a few tcp/ip client/server examples from a book and it works - sort of - but I noticed something strange. When I run my server I set it to use port 3001 and the client uses the same port to connect to server. They succeed, but the server prints something that doesn't really make much... (0 Replies)
Discussion started by: idelovski
0 Replies

6. HP-UX

how to clear particular port

Hi Everyone, How to check the status of the particular port and also clear it if it is locked without reboot? Please suggest. Thank you. (6 Replies)
Discussion started by: laxmikant
6 Replies

7. Programming

Using socket to test a TCP port

Hello, I'm trying to write a small c application to test a tcp port. This works fine for the most part but the default timeout on the connect is very long. I have been reading many posts but and it looks like I need to set the socket to be non-blocking and poll for a result. I have been totally... (2 Replies)
Discussion started by: tjones1105
2 Replies

8. Solaris

How to enable Serial port on ILOM, when Network Port is enabled in parallel

Hi Everyone, In my environment, I have few T5220. On the iLOM Management Card, I have both Network and Serial port are cabled, I don't have any issues while I try to connect using Network Management port, but when I try to connect the serial port for the same server which is actually connected... (3 Replies)
Discussion started by: bobby320
3 Replies

9. IP Networking

Get process id and port from the socket

Hello, Please help me in getting the process id and the port number from the socket netstat -Aan|grep -i closed f100050010b133b8 tcp 0 0 *.* *.* CLOSED f1000500119b53b8 tcp4 0 0 *.* *.* ... (3 Replies)
Discussion started by: Vishal_dba
3 Replies

10. AIX

Process on a specified Terminal and Socket Port does not start

Hi, I new to AIX, and I have been using Rocket UniData in it. I had to set up a Process for Data Exchange by assigning a unique Terminal and a Socket Port to that process. I ran the process for the first time and it was successful and after use I stopped the process. Now when I want to run it... (3 Replies)
Discussion started by: BejoyS
3 Replies
wait(1)                                                            User Commands                                                           wait(1)

NAME
wait - await process completion SYNOPSIS
/bin/sh wait [pid...] /bin/jsh /bin/ksh /usr/xpg4/bin/sh wait [pid...] wait [ % jobid...] /bin/csh wait DESCRIPTION
The shell itself executes wait, without creating a new process. If you get the error message cannot fork,too many processes, try using the wait command to clean up your background processes. If this doesn't help, the system process table is probably full or you have too many active foreground processes. There is a limit to the number of process IDs associated with your login, and to the number the system can keep track of. Not all the processes of a pipeline with three or more stages are children of the shell, and thus cannot be waited for. /bin/sh, /bin/jsh Wait for your background process whose process ID is pid and report its termination status. If pid is omitted, all your shell's currently active background processes are waited for and the return code will be 0. The wait utility accepts a job identifier, when Job Control is enabled (jsh), and the argument, jobid, is preceded by a percent sign (%). If pid is not an active process ID, the wait utility will return immediately and the return code will be 0. csh Wait for your background processes. ksh When an asynchronous list is started by the shell, the process ID of the last command in each element of the asynchronous list becomes known in the current shell execution environment. If the wait utility is invoked with no operands, it will wait until all process IDs known to the invoking shell have terminated and exit with an exit status of 0. If one or more pid or jobid operands are specified that represent known process IDs (or jobids), the wait utility will wait until all of them have terminated. If one or more pid or jobid operands are specified that represent unknown process IDs (or jobids), wait will treat them as if they were known process IDs (or jobids) that exited with exit status 127. The exit status returned by the wait utility will be the exit status of the process requested by the last pid or jobid operand. The known process IDs are applicable only for invocations of wait in the current shell execution environment. OPERANDS
The following operands are supported: One of the following: pid The unsigned decimal integer process ID of a command, for which the utility is to wait for the termination. jobid A job control job ID that identifies a background process group to be waited for. The job control job ID notation is applicable only for invocations of wait in the current shell execution environment, and only on systems supporting the job control option. USAGE
On most implementations, wait is a shell built-in. If it is called in a subshell or separate utility execution environment, such as one of the following, (wait) nohup wait ... find . -exec wait ... ; it will return immediately because there will be no known process IDs to wait for in those environments. EXAMPLES
Example 1: Using A Script To Identify The Termination Signal Although the exact value used when a process is terminated by a signal is unspecified, if it is known that a signal terminated a process, a script can still reliably figure out which signal is using kill, as shown by the following (/bin/ksh and /usr/xpg4/bin/sh): sleep 1000& pid=$! kill -kill $pid wait $pid echo $pid was terminated by a SIG$(kill -l $(($?-128))) signal. Example 2: Returning The Exit Status Of A Process If the following sequence of commands is run in less than 31 seconds (/bin/ksh and /usr/xpg4/bin/sh): sleep 257 | sleep 31 & jobs -l %% then either of the following commands will return the exit status of the second sleep in the pipeline: wait <pid of sleep 31> wait %% ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of wait: LANG, LC_ALL, LC_CTYPE, LC_MES- SAGES, and NLSPATH. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), jobs(1), ksh(1), sh(1), attributes(5), environ(5), standards(5) SunOS 5.10 12 Dec 1997 wait(1)
All times are GMT -4. The time now is 10:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy