Results 1 to 14 of 14

Thread: Get IP Address using DPlay 7 (Or in any other way)

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636

    Get IP Address using DPlay 7 (Or in any other way)

    Subject says it all.

    How do I get my IP address when I use DirectPlay 7?
    I am building a multiplayer game, when hosting, I'll need to give
    my IP to my friend that wants to connect. He needs my IP to connect, right? right.

    So how do I get my IP address?

    Thank you,
    Arie.
    Last edited by Arie; May 21st, 2004 at 11:34 PM.
    Tip Of The Day: Fake it 'till you make it !

  2. #2
    Member jonask's Avatar
    Join Date
    Apr 2004
    Location
    Sandefjord, Norway
    Posts
    38
    Well, you COULD add a winsock controler, connet it to www.myip.com/ by posing as a web client. And then parse the text it sends back =) that's what I would have done, anyways.

    This would of course just give you the ip that connected to the myip.com server, so if your behind a proxy it would most likly not work...
    --
    Jonas

  3. #3
    Fanatic Member alkatran's Avatar
    Join Date
    Apr 2002
    Location
    Canada
    Posts
    860
    Add a winsock control to a form and put the following code:

    sub form_load()
    msgbox Winsock.LocalIP
    'Name the winsock control "Winsock", duh
    end sub
    Don't pay attention to this signature, it's contradictory.

  4. #4
    Member jonask's Avatar
    Join Date
    Apr 2004
    Location
    Sandefjord, Norway
    Posts
    38
    That would only work if he's the ONLY computer sharing an internet connection. Most of the time you need the ip of your dsl modem or router. I guess
    --
    Jonas

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    Is that the only way? 'Cause I'm using it now.
    I don't like to add controls to my projects.

    Arie.
    Tip Of The Day: Fake it 'till you make it !

  6. #6
    Member jonask's Avatar
    Join Date
    Apr 2004
    Location
    Sandefjord, Norway
    Posts
    38
    Yeah, that's the only way at least that I'm aware of...
    If youre affraid that people havn't got the winsock controler installed (I don't think win2000 has it as default) you can just put the dll or ocx or whatever it was in your game dir and ship it along with your game. Thats what I allways do =)
    --
    Jonas

  7. #7
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    This might help: http://www.gamedev.net/community/for...opic_id=152760
    I'm yet to use DPlay and barely used much C++ but this guy seemed to have your problem and it was solved at the end .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    It's no use. I don't understand what he does there.
    I searched for this problem in Google.
    Found some pages that says that I can use the Registry to see my IP address. But how??
    Tip Of The Day: Fake it 'till you make it !

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    Please help!! Answer my last question...
    Tip Of The Day: Fake it 'till you make it !

  10. #10
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    Did they say where in the registry? Or is that a silly question.
    I've searched google but it seems to disagree that the registry has the IP address in it .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  11. #11

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    This code does not work:
    VB Code:
    1. Public Function GetIPAddress() As String
    2.   Dim keyServiceName As String
    3.   Dim keyInterfaces As String
    4.   Dim strServiceName As String
    5.   Dim strIPAddress As String
    6.  
    7.   keyServiceName = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\12"
    8.   keyInterfaces = "SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces"
    9.  
    10.   Set Reg = New Registry
    11.   Reg.GetKeyValue HKEY_LOCAL_MACHINE, keyServiceName, "ServiceName", strServiceName
    12.   keyInterfaces = keyInterfaces & "\" & strServiceName
    13.   R = Reg.GetKeyValue(HKEY_LOCAL_MACHINE, keyInterfaces, "IPAddress", strIPAddress)
    14.   GetIPAddress = strIPAddress
    15. End Function

    Now what?

    Arie.
    Tip Of The Day: Fake it 'till you make it !

  12. #12
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    I'm more surprised DPlay does actually tell you the IP. Did you check the Dx SDK?
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    I really don't know how. Can you or someone else check it for me?
    Tip Of The Day: Fake it 'till you make it !

  14. #14

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Israel
    Posts
    636
    Did someone check the DX SDK for me??

    I need the answer for it... please..
    There's gotta be some way to do this. If not, say it here.

    Arie.
    Tip Of The Day: Fake it 'till you make it !

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