Monitor an application's TCP port usage [Windows]

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

User avatar
kovan
Posts: 169
Joined: Mon May 26, 2008 7:40 pm UTC
Location: Toronto
Contact:

Monitor an application's TCP port usage [Windows]

Postby kovan » Fri Jul 11, 2008 3:31 pm UTC

Hokay I'm in the process of trying to do a bit of a rewrite for an old VB6 app in VB.NET (Two problems: I hate VB and I don't really know VB6 all that well). Anyway the thing is using REST communication, except that the server I'm trying to communicate with is searching for a service called "xMessenger" (Which will be completely meaningless to you guys). I suspect that this means there's something in either the old VB6 code that's doing some listening - or in the C++ library that I cleverly thought I could replace by using native .NET tools for communication.

So what I want is to know some software I can use that I can point at the exe of the VB program and have it tell me which ports get opened and closed. Any recommendations?

jimrandomh
Posts: 110
Joined: Sat Feb 09, 2008 7:03 am UTC
Contact:

Re: Monitor an application's TCP port usage [Windows]

Postby jimrandomh » Fri Jul 11, 2008 5:19 pm UTC

If you can see it working (that is, with the service it's trying to find actually present), you could use Wireshark (formerly known as Ethereal) to see what it does.

User avatar
thoughtfully
Posts: 2253
Joined: Thu Nov 01, 2007 12:25 am UTC
Location: Minneapolis, MN
Contact:

Re: Monitor an application's TCP port usage [Windows]

Postby thoughtfully » Fri Jul 11, 2008 5:28 pm UTC

The excellent Sys Internals utilities are still available, although they were bought by Microsoft
http://technet.microsoft.com/en-us/sysi ... fault.aspx

The tool you want is Tcpview (but it does UDP also :? )

You might also like to check out this site: http://sectools.org/
It has a list of the 100 best security tools (free and otherwise), updated annually.
Image
Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
-- Antoine de Saint-Exupery

User avatar
misskwiz
Posts: 96
Joined: Wed Mar 21, 2007 6:19 am UTC

Re: Monitor an application's TCP port usage [Windows]

Postby misskwiz » Sun Jul 20, 2008 9:07 am UTC

I second the use of Wireshark, I've used it before and it was extremely easy to use.

I took a brief look at tcpview and it seems like just a gui version of the netstat utility that comes with Windows (well XP pro anyways, I don't know for other versions of windows of course).

Here's a small example of the command 'netstat -a -b -v'

Code: Select all

TCP    superpos-a5eeee:1485   localhost:1484         ESTABLISHED     3524
  C:\WINDOWS\system32\mswsock.dll
  C:\WINDOWS\system32\WS2_32.dll
  C:\Program Files\Mozilla Firefox\nspr4.dll
  C:\Program Files\Mozilla Firefox\xul.dll
  -- unknown component(s) --
  [firefox.exe]

-a displays all connections and listening ports
-b displays the executable involved in creating each connection or listening port
-v when used with -b will display the sequence of components involved in creating each connection or listening port

I suspect that this means there's something in either the old VB6 code that's doing some listening - or in the C++ library that I cleverly thought I could replace by using native .NET tools for communication.

I downloaded tcpview and it did not have this component list feature which I assume would help you figure out what part of the code is doing the calling. Granted I've never done something like this and could be completely wrong :D.
I am currently enjoying the pathetic anger bread of a dissatisfied life.


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 7 guests