public static string GetServiceByPort(int port, string protocol) { NetworkUtils.ServEnt ent = NetworkUtils.GetServiceByPort(IPAddress.HostToNetworkOrder(port), protocol); if (ent == null) { return(null); } return(ent.s_proto); }
public static int GetServiceByName(string service, string protocol) { if (service == null) { return(-1); } NetworkUtils.ServEnt ent = NetworkUtils.GetServiceByName(service, protocol); if (ent == null) { return(-1); } return(IPAddress.NetworkToHostOrder(ent.s_port)); }