/// <summary> /// 通过设置的工程端口号获取进程 /// </summary> /// <returns></returns> private bool GetProcess() { try { if (Process != null && !Process.HasExited && Process.Id > 0) { //进程存在,无需重新获取进程对象 return(true); } else { int pid = NetProcessTool.GetPidByPort(Project.Port); if (pid > 0) { var p = Process.GetProcessById(pid); if (p != null) { //进程异常,重新获取进程对象信息 ProcessRefreshCount++; Process = p; return(true); } } } } catch { } Process = null; return(false); }
void GetConnection() { TcpConnection = NetProcessTool.GetTcpConnection(); UdpConnection = NetProcessTool.GetUdpConnection(); }
private TcpRow[] Fun3() { TcpRow[] list = NetProcessTool.GetTcps(); return(list); }