• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Icebone1000

How to get adress from adapters?

2 posts in this topic

Returning adresses with getaddrinfo is kind a blind thing..even specifying AI_PASSIVE and the computer name, I cant know where are the addresses Im interested on..

More specific, executing ipconfig /a//, I can see 2 titles that Im interested on: Wireless LAN adapter Wireless Network Conection and Ethernet Adapter Local Area Connection...In the case, I would test to see the one who doesnt have the media disconnected state, and get its IP...With getaddrinfo the first address on the list is my virtual box ip =__=, the thing I use to trade files with the win2000 I have installed on virtual box...

I want know if theres a way I can do this straight from the info I have from getaddrinfo, without using the ip helpers apis..How can I know the networking availability on the addresses returned with a hostname?
0

Share this post


Link to post
Share on other sites
[quote name='Icebone1000' timestamp='1300474091' post='4787620']
Returning adresses with getaddrinfo is kind a blind thing..even specifying AI_PASSIVE and the computer name, I cant know where are the addresses Im interested on..

More specific, executing ipconfig /a//, I can see 2 titles that Im interested on: Wireless LAN adapter Wireless Network Conection and Ethernet Adapter Local Area Connection...In the case, I would test to see the one who doesnt have the media disconnected state, and get its IP...With getaddrinfo the first address on the list is my virtual box ip =__=, the thing I use to trade files with the win2000 I have installed on virtual box...

I want know if theres a way I can do this straight from the info I have from getaddrinfo, without using the ip helpers apis..How can I know the networking availability on the addresses returned with a hostname?
[/quote]

What you want isn't, strictly speaking, well defined. A machine may have zero or more physical interfaces. Each interface may have zero or more virtual interfaces. Each virtual interface may have zero or one IPv4 address, zero or more IPv6 addresses, and zero or more default gateways.

You could enumerate all the interfaces using OS-specific functions (such as Windows Management and Instrumentation), and then ask for the IPv4 address for each (if present), and then filter addresses by certain criteria:
- if it has no default gateway, it's probably not interesting
- if it has an address in the 10.x, 192.168.x or 172.16.x subnet ranges, it's probably not interesting unless you only want to talk to a LAN

Unfortunately, for 99.999% of all home computers, this will filter out all interfaces, because the NAT gateway/router will re-write your address to some public address, to be visible from the outside. To get around this, you need to use a NAT introducer. The FAQ has more information.
1

Share this post


Link to post
Share on other sites
WMI and the IPHLPAPI are the only two native API methods for retrieving IP information. WMI is hit or miss on a good day, so I would avoid it. It's also COM, so unless you are a COM guru, or you are working in a managed language, that's another reason to avoid it.

To query a list of adapters on the local system I use GetAdaptersAddresses(). This function will return a linked list of IP_ADAPTER_ADDRESSES structures. ( See the MSDN page about allocating the buffer for these structures ). The IP_ADAPTER_ADDRESSES structure has a member named friendlyname that is the name you see when you bring up network connections. This is the only function call / structure I have encountered that contains this information. The adaptername is the GUID identifying the adapter on the system. The rest of the members are somewhat self explanatory, and explained decently well on MSDN.

Even with the IPHLPAPI there are some other caveats that I have encountered dealing with network interfaces: 1) If the interface is disabled, then it will not be included in the list. 2) If the interface is disconnected ( cable unplugged ) then it will not return any IP information even if it is statically configured. To get the current static configuration when the adapter is disconnected, use the registry. I've actually found that the registry is the most reliable source of information for getting an adapters configuration. 3) If you need netmask, then you need to go to a different API ( or get it from the registry ). For some reason netmask was omitted from GetAdapterAddresses() / IP_ADAPTER_ADDRESSES. 4) If you need to change the IP configuration of an adapter, there is no native API. Use CreateProcess and netsh.exe. WMI can configure an interface, but cannot configure an interface that is disconnected.

To get the media state, I use GetIfEntry().

--Z
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0