Results 1 to 4 of 4

Thread: detecting server's ip address by the client

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Location
    Philippines
    Posts
    246

    detecting server's ip address by the client

    Is it possible to detect the ip address of the server you are connecting?

    for example, using winsock, if the server created and started to listen at port "8080" and the ip address is for example "192.168.10.2"

    if i'm the client, I can connect by setting the local port to 8080 by default, but the ip is not always the same, so for example the ip address of the server that i'm connecting to, is "192.168.10.2", so what if the i'm going to connect to ip address "192.168.10.3", is there anyway I can detect whose IP addresses created? even if we're not yet connected?

  2. #2
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: detecting server's ip address by the client

    Not as far as I know, unless you want to make the server broadcast a message every now and then to all machines on the network... which is probably not a great idea.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  3. #3
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: detecting server's ip address by the client

    When the client needs to know the IP address of the server, have it broadcast a "where are you?" UDP message to which the server would reply (without broadcasting!) with its IP.
    Thats one solution.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  4. #4
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: detecting server's ip address by the client

    Ah yeah I didnt think of doing it the other way around
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


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