Results 1 to 5 of 5

Thread: Getting the IP

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2006
    Posts
    4

    Getting the IP

    How can I get the IP of the client? I have the code setup like this;
    VB Code:
    1. CData.structSocket = Server_Tcp.AcceptSocket()
    2.             Interlocked.Increment(connectId)
    3.             CData.structThread = New Thread(AddressOf ReadSocket)
    4.             CData.SelfID = connectId

    Do i need something extra?

  2. #2
    Fanatic Member TokersBall_CDXX's Avatar
    Join Date
    Mar 2003
    Location
    America
    Posts
    571

    Re: Getting the IP

    Quote Originally Posted by Mr_mo
    How can I get the IP of the client? I have the code setup like this;
    VB Code:
    1. CData.structSocket = Server_Tcp.AcceptSocket()
    2.             Interlocked.Increment(connectId)
    3.             CData.structThread = New Thread(AddressOf ReadSocket)
    4.             CData.SelfID = connectId

    Do i need something extra?
    hmm you may want to post just a wee bit more of your code to demonstrate exactly what you're trying to do.
    Build your own personalized flash based chat room for your webpage for FREE! http://www.4computerheaven.com

  3. #3
    Hyperactive Member kazar's Avatar
    Join Date
    Apr 2006
    Location
    UK
    Posts
    323

    Re: Getting the IP

    Did you want the internal or external ip?
    KAZAR

    The Law Of Programming:

    As the Number of Lines of code increases, the number of bugs generated by fixing a bug increases exponentially.
    __________________________________
    www.startingqbasic.co.uk

  4. #4
    Member
    Join Date
    Jun 2002
    Location
    Madras
    Posts
    50

    Re: Getting the IP

    try this

    using system.net;

    string hostname = Dns.GetHostName();
    IPHostEntry local = Dns.GetHostByName(hostname);
    local.AddressList.GetValue(0);
    MessageBox.Show(local.AddressList.GetValue(0).ToString());
    venkat

    Strength is Life, Weakness is Death

    - Swami Vivekananda

  5. #5
    Fanatic Member TokersBall_CDXX's Avatar
    Join Date
    Mar 2003
    Location
    America
    Posts
    571

    Re: Getting the IP

    Quote Originally Posted by nvenkat75
    try this

    using system.net;

    string hostname = Dns.GetHostName();
    IPHostEntry local = Dns.GetHostByName(hostname);
    local.AddressList.GetValue(0);
    MessageBox.Show(local.AddressList.GetValue(0).ToString());

    one could suspect that the user requesting help is asking how to retrieve the IP address of clients connecting to a server.. not his own local IP address

    though as I stated above, they need to provide some more of their source code.

    we need to know what they are using to implement their server.
    Build your own personalized flash based chat room for your webpage for FREE! http://www.4computerheaven.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width