mecano14_bis

I cant find how to realize a process(PID) to port mapping with C#

For example : port 21 is used by PID 826 (Filezilla.exe)

Someone knows if it's possible



Re: Visual C# General [C#] Process to port mapper

Peter Ritchie

You could always spawn "netstat -b"






Re: Visual C# General [C#] Process to port mapper

mecano14_bis

Yes i could parse answer from netstat but i'm looking for a "clean" way to do (like a GUI for netstat)

I have searched everywhere on the internet unsucessfully

Maybe that is not possible with C#





Re: Visual C# General [C#] Process to port mapper

Karthikeya Pavan Kumar .B

Try this Netstat Example






Re: Visual C# General [C#] Process to port mapper

mecano14_bis

I have already seen this one but it does not explain how to perform a port to process mapping.





Re: Visual C# General [C#] Process to port mapper

mecano14_bis

Update for awaking US people Smile





Re: Visual C# General [C#] Process to port mapper

Peter Ritchie

There's nothing in .NET to directly do what you want to do. In order to do what you want you'll have to PInvoke several Win32 functions. These functions use several structures that you'll have to define and marshal. For another example see http://files.codes-sources.com/fichier.aspx id=11430&f=easy_socket%5Ciphelper.cs






Re: Visual C# General [C#] Process to port mapper

mecano14_bis

Thanks that is very helpful !