'네트워크 연결'에 해당되는 글 2건

  1. 2010.04.23 [C#] 네트워크 이용률 알아보기
  2. 2010.04.23 [C#] 네트워크 카드 이름 받아오기.
언어/C#2010.04.23 18:01
 

 using System.Diagnostics ;

 protected PerformanceCounter NetCounter;

 public MyMain(LoginData _Data)
        {

            NetworkInterface[] adapter = NetworkInterface.GetAllNetworkInterfaces();
            String NetworkCard = adapter[0].Description.ToString();  //---> 인터넷 연결된 카드는 항상 0번째

            
            NetworkCard = NetworkCard.Replace('(', '[');
            NetworkCard = NetworkCard.Replace(')', ']');
            NetworkCard = NetworkCard.Replace('/', '_');

            NetCounter= new PerformanceCounter();
            NetCounter.CategoryName = "Network Interface";                 
            NetCounter.CounterName = "Bytes Total/sec";
            NetCounter.InstanceName = NetworkCard ;

더보기




          
         }


 private void MyMain_Load(object sender, EventArgs e)
        {
            Timer T = new Timer();
            T.Interval = 1000;
            T.Tick += new EventHandler(UseingCpuPer);
            T.Start();
        }


  public void UseingCpuPer(Object sender , EventArgs e)
        {
            progressBar3.Value= (int)NetCounter.NextValue();
            label54.Text = progressBar3.Value.ToString();

더보기


          }

Posted by 최우림 -=HaeJuK=-
언어/C#2010.04.23 17:46
//---------- 추가 해야될 참조..  .Net Framwork 2.0
ing System.Net.NetworkInformation;

//---------- 컴퓨터의 모든 네트워크의 정보를 받아온다.
NetworkInterface[] Adapters = NetworkInterface.GetAllNetworkInterfaces();

//---------- 돌면서 뽑아 주세요
foreach(NetworkInterface Adapter in Adapters )
{
MessageBox.Show(Adapter.Description.ToSTring());
}
Posted by 최우림 -=HaeJuK=-

티스토리 툴바