?
Solved

Get the name of a window related to a network connection

Posted on 2003-03-15
8
Medium Priority
?
288 Views
Last Modified: 2011-04-14
In delphi, is there any way to enumerate all network connections currently active and find out what window/process they were created from. Thanks in advance.
0
Comment
Question by:ippopotimus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 2

Expert Comment

by:steve_hsk
ID: 8146079
Hi ippopotimus ...

The short answer is of course YES (but I only know for XP) :-O ...

Stage One : Retreiving the list of Active Connections (NetStat through code) :
I'm not being lazy here, but I've just answered another question that asked how to do this ...
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20552007.html

Stage Two : Associating this data with the process using it :
If you are doing this for XP, this is relatively easy, using the undocumented IPHlpAPI function - AllocateAndGettcpExTableFromStack

The following site provides a simple example in C (sorry - haven't had the time to convert this to Delphi yet) that demonstrates listing the active connections and associating their Process IDs (PID)s
http://www.vbcity.com/forums/topic.asp?tid=8785

A tutorial explaining this method :
http://www.pcquest.com/content/coding/102082103.asp

A genral IPHlpAPI delphi site (in french) ... but good code example ...
http://iglooduhack.free.fr/delphi_ip_helper.php

For NT4 and 2000, I'm convinced that this is available in the MIB, but I can't find it at all !!!

The only other idea was to interface with the NDIS drivers and retrieve the PID vs Socket bindings.

I'll keep looking however ... This is actually an old project of mine that I never completed for NT4/2000 !!!

Hope this gets you started,
STeve

0
 
LVL 2

Expert Comment

by:steve_hsk
ID: 8146114
As an extra, I know this is possible on the 2000, NT4 platforms ... so dont give up ...

An excellant website (!) in general, but it has 2 utilities that list port Vs PID : TCPView.EXE and TDIMon.EXE :

http://www.sysinternals.com/ntw2k/utilities.shtml

STeve
0
 

Author Comment

by:ippopotimus
ID: 8146399
i really need this for windows 2000
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 4

Expert Comment

by:nestorua
ID: 8146965
HI,
Try WNetOpenEnum, WNetCloseEnum, WNetEnumResource functions.
Sincerely,
Nestorua.
0
 
LVL 2

Expert Comment

by:steve_hsk
ID: 8155024
Ipp ... I'm still trying ... your question has renewed my interest ... if you make any progress, let me know :-)

Nestorua ...

"The WNetCloseEnum function ends a network resource enumeration started by a call to the WNetOpenEnum function."

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wnet/wnet/wnetcloseenum.asp

From my understanding, this API set controls the actual network connection (RAS/LAN/WAN). I think (?) that Ipp wants to be able to list sockets that have active connections (IP/Port), owned by processes or apps.

I'm convinced that you can do this via the TDI Layer, using TDI_CONNECTION_INFO or TDI_CONNECTION_INFORMATION. Will keep working on it !

STeve
0
 

Expert Comment

by:CleanupPing
ID: 9316757
ippopotimus:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10639938
PAQed, with points refunded (490)

modulo
Community Support Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month9 days, 15 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question