Questions tagged [netstat]
netstat (network statistics) is a command-line tool that displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics. It is available on Unix, Unix-like, and Windows NT-based operating systems.
netstat
543
questions
2139
votes
19
answers
1.8m
views
Who is listening on a given TCP port on Mac OS X?
On Linux, I can use netstat -pntl | grep $PORT or fuser -n tcp $PORT to find out which process (PID) is listening on the specified TCP port. How do I get the same information on Mac OS X?
447
votes
37
answers
682k
views
Port 80 is being used by SYSTEM (PID 4), what is that?
I am trying to use port 80 for my application server, but when I perform netstat -aon I get:
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4
When I look up the process in task manager, it shows PID 4 is SYSTEM,...
142
votes
5
answers
275k
views
How to get default gateway in Mac OSX
I need to retrieve the default gateway on a Mac machine. I know that in Linux route -n will give an output from which I can easily retrieve this information. However this is not working in Mac OSX(...
124
votes
13
answers
215k
views
How to check if a network port is open?
How can I know if a certain port is open/closed on linux ubuntu, not a remote system, using python?
How can I list these open ports in python?
Netstat:
Is there a way to integrate netstat output ...
119
votes
8
answers
131k
views
Docker: any way to list open sockets inside a running docker container?
I would like to execute netstat inside a running docker container to see open TCP sockets and their statuses. But, on some of my docker containers, netstat is not available. Is there any way to get ...
82
votes
4
answers
282k
views
How do I find which application is using up my port? [closed]
I am unable to start GlassFish, because it keeps showing this error message:
SEVERE: Shutting down v3 due to startup exception : No free port within range: 8080=com.sun.enterprise.v3.services.impl....
62
votes
4
answers
60k
views
Docker and netstat: netstat is not showing ports, exposed by docker containers
I expose docker ports of my contaners to the host machine with something like
docker run -p 80:80 ...
then I try to display all listening ports for debugging purposes with netstat e.g.:
netstat -at
...
61
votes
4
answers
105k
views
What does "Can not obtain ownership information" in Netstat -ab mean?
(Windows 7 x86)
If I run netstat -ab, I get a list of active connections, along with the names of the applications which have opened the connections.
However, some connections (including the one ...
58
votes
12
answers
127k
views
Starting apache fails (could not bind to address 0.0.0.0:80)
Update: Already fixed, it seems that one of VirtualHosts configurations files was wrong in sites-enabled.
I have Ubuntu 11.10
When I run the command to start apache2:
sudo /etc/init.d/apache2 start
...
54
votes
5
answers
37k
views
difference between netstat and ss in linux?
In linux, netstat command tells us information of active sockets in system.
I understand that netstat uses /proc/net/tcp to acquire the system network information.
Since netstat man page says that ...
40
votes
2
answers
89k
views
Use of Recv-Q and Send-Q
What is the use of the Recv-Q and Send-Q columns in netstat's output? How do I use use this in a realistic scenario?
On my system, both of the columns are always shown as zero. What is the meaning ...
39
votes
2
answers
54k
views
Installing netstat on docker linux container
I want to install netstat on my Docker container.
I looked here https://askubuntu.com/questions/813579/netstat-or-alternative-in-docker-ubuntu-server-16-04-container so I'm trying to install it like ...
36
votes
3
answers
24k
views
netstat showing foreign ports as kubernetes:port. What does this mean?
I am using a Windows 10 Pro machine.
When I run netstat, it is showing kubernetes:port as foreign address in active connections.
What does this mean? I have checked and there is no kubernetes ...
31
votes
7
answers
72k
views
How do I interpret 'netstat -a' output
Some things look strange to me:
What is the distinction between 0.0.0.0, 127.0.0.1, and [::]?
How should each part of the foreign address be read (part1:part2)?
What does a state Time_Wait, ...
30
votes
6
answers
108k
views
Troubleshooting connections stuck in CLOSE_WAIT status
I have a Java application running in WebLogic 11g on Windows, which after several days, becomes unresponsive. One suspicious symptom I've noticed is that a large number of connections (about 3000) ...
29
votes
3
answers
24k
views
Debugging IDE's port connection to XDebug: "Waiting to Connect"
Preamble
Like many, I've spent more hours debugging my IDE’s connection to XDebug than I have using XDebug to debug my programs. I’ve gotten it to work repeatedly, but every once and a while I get ...
26
votes
2
answers
15k
views
When using Docker, ESTABLISHED connections don't appear in netstat
I have a docker container running on RHEL 7 with Docker 1.7.0. The program which running in this container listens for TCP connections on port 5000.
In my Dockerfile I put the sentence EXPOSE 5000 and ...
25
votes
2
answers
28k
views
Address already in use but nothing in netstat or lsof
I try to start the Python SimpleHTTPServer on port 7054 :
$ sudo python -m SimpleHTTPServer 7054
...
socket.error: [Errno 98] Address already in use
So, I ran the following commands :
$ sudo ...
23
votes
1
answer
28k
views
TCP connection owned by pid zero
I'm trying to ensure that a Windows service program (running on top of .NET) is properly releasing its network connections.
When running the service locally I know that it will create a lot of HTTP ...
22
votes
1
answer
33k
views
Node.js server only listening on ipv6
I am running a node.js server on port 5403. I can telent to the private ip on this port but cannot telnet to the public ip on the same port.
I assume the cause of this is because node.js is only ...
21
votes
1
answer
35k
views
How do I access netstat data in Python?
I'm trying to need to access/parse all outgoing connections on a particular port number on a Linux machine using a Python script. The simplest implementation seems to be to open a subprocess for ...
19
votes
2
answers
26k
views
Tracking an application's network statistics (netstats) using ADB
I have a feeling this is possible, I'm just not quite sure where the information is held.
I want to get the up/down statistics for specific applications, but I want to do it using ADB and not ...
17
votes
1
answer
13k
views
netstat -na : udp and state established?
In an application (voip rtp media server), netstat -na on the server (172.16.226.3 bound to udp port 1286) gives the following line :
udp 0 0 172.16.226.3:1286 172.25.14.11:10000 ESTABLISHED
As an ...
16
votes
1
answer
51k
views
What could cause so many TIME_WAIT connections to be open?
So, I have application A on one server which sends 710 HTTP POST messages per second to application B on another server, which is listening on a single port. The connections are not keep-alive; they ...
16
votes
1
answer
11k
views
Network Activity Monitoring on iPhone
I've been working for 5 days trying to learn and implement Network monitor on the iPhone.
I looked into netstat code from apple, and i lost like 25% of my hair.
I found links for JB Devices but i ...
14
votes
2
answers
53k
views
listing multicast sockets
I am trying to list all opened multicast sockets on a linux system? netstat -g lists the groups joined though. Is there any other utility that I can use for this sake?
Thanks a lot for the help.
14
votes
2
answers
7k
views
How to kill the application that is using a TCP port in C#?
I want to free a TCP port during startup of my application (asking confirmation to user), how to get the PID number and then, if the user confirm, kill it?
I know I can get this information by ...
13
votes
4
answers
14k
views
What are the differences between lsof and netstat on linux?
I encounted a problem today:
When I started HDP docker container, an error occured:
listen tcp 0.0.0.0:8086: bind: address already in use
According to error message, I know that port 8086 was ...
13
votes
2
answers
47k
views
How to find port number for a particular process id in unix? [closed]
In UNIX OS, how can I find the port number when i know the process name or pid ?
13
votes
5
answers
9k
views
Process started from system command in C inherits parent fd's
I have a sample application of a SIP server listening on both tcp and udp ports 5060.
At some point in the code, I do a system("pppd file /etc/ppp/myoptions &");
After this if I do a netstat -apn,...
13
votes
4
answers
33k
views
How to find a free TCP port
How do I find a completely free TCP port on a server? I have tried the command line;
netstat -an
but I am told the ones with a status of LISTENING are already being used.
I also tried a tool ...
11
votes
3
answers
14k
views
Tomcat Debug Error: Unable to open debugger port (127.0.0.1:63199): java.net.BindException "Address already in use: NET_Bind"
I woke up for work and started receiving this error, but I can't find this specific error anywhere.
I tried using netstat -ano to find any instances running on the aformentioned port, and also the ...
11
votes
2
answers
30k
views
How to use ADB shell to find the ports which a process is using?
For example, in Android, the PID of a process 1234 is using ports 2222,2223,2224. Now I have a PID 1234. I was wondering how to find out port numbers 2222, 2223, 2224 which the process is using?
I ...
10
votes
3
answers
12k
views
How To Monitor Network Activity From Within App?
I'm trying to monitor network activity on my iPhone from within an app I'm developing. Does iOS support a netstat-like command or something similar that can tell me what what inbound and outbound ...
10
votes
1
answer
18k
views
How to find out application name by PID (process id)
I'm trying to install VisualSVN server and have message "Specified TCP port is occupied by another service". How I can find what service or app is using the 443 port?
"netstat -aon" shows me only
...
10
votes
0
answers
2k
views
How to find the other point of a Unix domain socket on Mac OS X to write/read it?
I listed open file for a process (a daemon) on my box which runs Mac OS X 10.5 :
>lsof -p 89
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
...
xxxxx 89 xxxxxxxx 9u unix ...
9
votes
5
answers
17k
views
Extract IP from netstat output
The netstat output contains thing like...
tcp 0 0 0.0.0.0:80 221.126.149.99:51973 ESTABLISHED 23879/apache2
tcp 0 0 0.0.0.0:80 66.249.68.154:40883 ...
9
votes
1
answer
5k
views
The PID/Program name of netstat is dash even with sudo
developer@LinuxKernel:~> sudo netstat -elnopt
developer's password:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State User ...
9
votes
1
answer
5k
views
Used port not showing up in netstat -a result
This issues started recently when I am trying to start active-mq (which by default starts on port 61616). But suddenly it stopped coming up with JVM_BIND issue on that port. The problem did not go ...
8
votes
2
answers
14k
views
Breaking out of FOR in batch
My current line of batch code is:
for /L %%a in (8000,1,8100) do netstat /a /n | find "%%a" | find "LISTENING" || set tmp_freeport=%%a && goto found
The idea is to find a free port that will ...
7
votes
0
answers
4k
views
Undefined error in httr call. httr output: Failed to connect to localhost port 14415 after 0 ms: Connection refused
After updating to RStudio Version 2022.12.0+353 (2022.12.0+353), I am unable to find a freeport using netstat.
I have never had this problem before. How do I fix this?
library(RSelenium)
library(...
7
votes
0
answers
1k
views
How to find the exact process, which is behind TCP connection to HTTP.SYS process
When I use netstat, I receive info like this - PID 4 means HTTP.SYS
Active Connections
Proto Local Address Foreign Address State PID
TCP 0.0.0.0:80 0.0....
6
votes
3
answers
35k
views
In mac terminal, how to check which port mysql is running?
I've done some research and found several places where people suggest using netstat to check which port a particular process is using.
But here is what I got:
myMac:~/Documents$ netstat -ap tcp | ...
6
votes
1
answer
35k
views
netstat does not show listening port of udp server?
I have the following udp server:
/************* UDP SERVER CODE *******************/
#include <stdio.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#...
6
votes
4
answers
21k
views
Remove netstat output (specifically Not all processes could be identified line)
I'm having trouble removing the output from the netstat command when I check if a current port is being used. I dont need the output of the command but rather just the error code.
Running netstat -...
6
votes
1
answer
7k
views
Equivalent of netstat -pant with the Mac
In Ubuntu, to see the listening process I used to do the following command netstat -pant I would get something similar to this
What is the equivalent command with the Mac ?
6
votes
3
answers
4k
views
the command "netstat -p" doesn't display the pid
the shell command netstat -p , doesn't display the pid.
It displays "-" like this:
tcp 0 0 *:2181 *:53837 ESTABLISHED -
why?
It still display "-" although I use root to login.
6
votes
2
answers
13k
views
How do I run a PowerShell script as a service?
I created the script below to check my application's port 2025 and log the number of connections.
I need this script to run as a service on Windows with the name netstat_2025. Does anyone know if ...
6
votes
1
answer
7k
views
Netstat -ban (or -oan) equivalent in .NET
I'd like to know if a particular process is using a given port, i.e. netstat -ban. I came across using IPGlobalProperties to get the list of active connections, but this doesn't seem to include ...
6
votes
3
answers
4k
views
Android: HttpURLConnection doesn't disconnect
by running netstat on the server:
UNTIL A FEW DAYS AGO: I could see the connection being ESTABLISHED only for about a second, and then it would disappear from the list
NOW: it stays as ESTABLISHED for ...