Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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));
        }