Net-informations.com
SiteMap  | About    

How to find hostname of a computer

The System.Net classes provide functionalities that is similar to Microsoft WinInet API , it allows classes to communicate with other applications by using the Hypertext Transfer Protocol (HTTP), Transmission Control Protocol (TCP), User Datagram Protocol (UDP), and Socket Internet protocols.

The following C# program show how to find the Host name of a computer.

  Dns.GetHostName();



using System;
using System.Net;
using System.Windows.Forms;

namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show (Dns.GetHostName());
        }
    }
}






net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.