Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can netstat filter specific ports ?

Status
Not open for further replies.

grahama1970

Technical User
Jan 24, 2004
9
US
I want to filter out everything but TCP port 8181
netstat -np TCP 8181 5

obviously, this gives an error. Is there a way to do this? Or, is there another Windows command line utility that can do filter for specific ports

many thanks
g
 
Yes there is.
The FIND command will do the trick:
netstat -np TCP | find "8181"
And if you add the /c switch you get the number of entries.
 
many many thanks
I am very new to command line windows stuff....
and, this is exactly what I needed

good karma to you :)
g
 
one more question

is it possible to use get the actual url too ?

My application is sending the http request:
using Netstat and your 'find' command:
netstat -np TCP |findstr "8181 8182 8183"
TCP 127.0.0.1:4729 127.0.0.1:8181 SYN_SENT

is it possible to get the above url, too ?

many thanks
g
 
Not that I know of.
The netstat command shows your current connections; OSI layer 4.
Everything behind the ? is meant for the Webserver and has nothing to do with a TCP/IP connection. And http is 'living' in the OSI layer 7.

Why do you want to get the URL in the Command Line.
Perhaps you should post your question in the Microsoft:Windows XP Pro forum.
 
My guess is that you would need to have a look at running some kind of CGI script but that can be trouble as it would also mean others can run scripts if you don't control it neatly.

What exactly are you trying to do?

If this is to monitor a website on port 8181 could you not put website logging on it instead?
 
many thanks for your replies :)
I am trying to get two desktop applications to communicate with one another. I am using a BACKGROUND app to extend the abilities of the FOREGROUND APP
;
The problem:
My FOREGROUND app can only communicate to the outside world by sending ftp/http requests. My hope is to parse everything after the '?' and use it to give commands to my BACKGROUND app like: ;
Foreground app:
This app is a Quicktime wired media app. A Quicktime wired application is similar to a standalone Flash movie or a Java Swing App. Its limitation is that it can only communicate by sending http requests. This is great for communication with a php/mysql remote server, but not so good when communicating locally.
;
Background app:
Written in NSIS from NullSoft. NSIS is a flexible platform that is normally used for writing 'installer' apps. A 'nsis' app can do pretty much whatever you need as plugins are plentiful and you can write your own dlls:)
;
I CAN use NSIS to control netstat or tcpvcon. Everytime port 8181 communication is detected, NSIS could execute a command. Port 8181 = quit. Port 8182 = some_cmd. This method just seems a bit crude and prone to problems :(
;
What would be the best way to do this kind of inter app communication ?
;
many thanks for all of your help
g
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top