🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Getting your own TCP/IP address

Started by
8 comments, last by Keith P Parsons 23 years, 10 months ago
I''m writing a game using directPlay. One thing I haven''t figured out yet is how to get your own TCP/IP address. Does anyone know how to do this? Also does anyone know how to generate a GUID?
Advertisement
For your GUID... I think it is defined in Windowsx.h file...

TCP/IP? Well... I''ll leave that to someone else, because it is all speculative from my point of view


-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet :)
I think the guid generator is guidgen and the tcp/ip address can be obtained from winipconfig (win98) and ipconfig (NT)

Both the exact names can be found in the DirectPlay docs..

..
Here is the code that I use from my program :

    in_addr *getOurInfo(){    HOSTENT *hostEntry;     // Pointer to host entry structure	// Find the full internet info for this computer.	hostEntry = gethostbyname("localhost");	hostEntry = gethostbyname(hostEntry->h_name);    printf("\nHost Name........: %s", hostEntry->h_name);	return (in_addr *)hostEntry->h_addr_list[0];};    


obviously, we can then use inet_ntoa(*getOurHostInfo()) to find the actual string.
I''d just like to point out that this will get a ipaddress of the computer, and not neccessarily the one attached to the internet...

Also it does not account for NAT...

though it would handle 95% of the cases
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
YOU DON''T HAVE TO GET YOUR OWN IP in DP

you have your DPID

you need just know the IP of the server...which the user have to enter or if you have an online server..so you know it already

get it?
What if you need to find the IP address of your own computer, because it will be the game server?

------------------------------
#pragma twice
To create a GUID, you can use GUIDGEN.EXE which is in the VC\bin directory of the developer studio installation or use CoCreateGUID(), look it up on the MSDN.

------------------------------
#pragma twice
even if your comp is the HOST one, you still don''t need it''s ip


unless you mean you wanna to join the host...

and way

i see you all do the hard way to create a guid...

so...

(with msvc6)
project-->add to project-->components and controls-->visual c++ components-->create GUID--> ok

then it will add a defie for the guid
Wouldn''t you still need an IP address so you know what to give the people trying to connect to your host?

I mean, most multiplayer games have a master server where they register their IP (or maybe have it printed to a web page where potential players can view it?).. so the code may need to know what the i-net IP is.. hmm, can you somehow pick the active device?

- From the guy who can''t even program in windoze..



---
Irek | irek@seventh.net
---Irek | irek@seventh.net

This topic is closed to new replies.

Advertisement