Read ip of website visited in c#

Get list of website visited

Page 1 of 1

1 Replies - 2172 Views - Last Post: 25 April 2010 - 03:22 AM Rate Topic: -----

#1 makdu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 14-July 09

Read ip of website visited in c#

Posted 25 April 2010 - 01:28 AM

Hi,
I want to read the ip of webiste visited . Is there a way to get this. i tried to use some example of packet sniffer which uses an ansynchronous call . but that didnt help, as i am not able to continue with any other process when the asynchornous call is happening
 mainSocket.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None, new AsyncCallback(OnReceive), null);
   private void OnReceive(IAsyncResult ar)
        {
            try
            {

                int nReceived = mainSocket.EndReceive(ar);

                //Analyze the bytes received...

                ParseData(byteData, nReceived);
 byteData = new byte[4096];
 mainSocket.BeginReceive(byteData, 0, byteData.Length, SocketFlags.None,
                        new AsyncCallback(OnReceive), null);
                          timer1Sec.Enabled = true;

but the timer1sec is not getting called again. Please help

Is This A Good Question/Topic? 0
  • +

Replies To: Read ip of website visited in c#

#2 Core   User is offline

  • using System.Linq;
  • member icon

Reputation: 784
  • View blog
  • Posts: 5,101
  • Joined: 08-December 08

Re: Read ip of website visited in c#

Posted 25 April 2010 - 03:22 AM

To get the address for the host:

public System.Net.IPAddress[] GetAddresses(string host)
{
    System.Net.IPAddress[] addressList = System.Net.Dns.GetHostAddresses(host);

    return addressList;
}



Call the above function like this:

foreach (System.Net.IPAddress address in GetAddresses("dreamincode.net"))
{
    Debug.Print(address.ToString());
}


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1