public static string Win32GetProcessNameByPort(TcpOrUdp type, uint dwPort) { uint processId = GetProcessIdByPort(TcpOrUdp.TcpType, dwPort); Process p = Process.GetProcessById(Convert.ToInt32(processId)); return(p.ProcessName); }
public static void Win32KillProcessByPort(TcpOrUdp type, uint dwPort) { uint processId = GetProcessIdByPort(TcpOrUdp.TcpType, dwPort); Win32KillProcessById(processId); }
private extern static uint GetAllPortByProcessId(TcpOrUdp type, uint dwProcessId, uint[] dwAllPort, uint dwMaxLen);
public static uint Win32GetProcessIdByPort(TcpOrUdp type, uint dwPort) { return(GetProcessIdByPort(TcpOrUdp.TcpType, dwPort)); }
private extern static uint GetProcessIdByPort(TcpOrUdp type, uint dwPort);