GetExtendedTcpTable でソケットのプロセスIDを調べる - たていすのメモ2

Windowsで netstat -ano のような、ソケット一覧にプロセスIDがついたものを出力するコード。 GetTcpTable() ではプロセスIDが出ないしAllocateAndGetTcpExTableFromStackはdeprecatedで、GetExtendedTcpTable はXP SP2とVistaで使える。はず。 using System; using System.Collections.Generic; using System.Text; using…