When im binding my socket, i want to find out what local address that is connected to the internet, if there are any, and bind it to that address.
What is the best way to get this info? getaddrinfo() dosn't know if an address is connected to a lan that has no internet access, or if it is connected to a lan with an internet forwarding gateway, or if its directly connected to internet via PPPoE or something like that.
Maybe this info be found in the windows register?
(just using INADDR_ANY dosn't cut it in this case, i need a specific address to bind to)
To clearify what i want to use this for im writing an utility that moitors my internet traffic.
Why won't using INADDR_ANY cut it? Not sure what you're trying to do, but if you're developing a server than the right thing to do is use INADDR_ANY when binding...in fact if you read any network book they all advise you to use INADDR_ANY when binding.
What about when you bind to a localhost that is multi-homed? It's better to use INADDR_ANY to let the TCP stack listen on ALL addresses and do the assignment for you.
Yours Truly, The One and Only! devmentor.org
Design, Code, Test, Debug
Maybe im going about this the wrong way, what i want to do is to write an application that i can use to log my games network traffic. I am doing this by setting the SIO_RCVALL option with ioctl(), so that recvfrom() returns both sent and received packets. But using this option with ioctl() only works if i have bound my socket to a specific address, INADDR_ANY will cause it to fail.
I suppose i could just enumerate all addresses and listen to them all, but that feels like a waste, and could complicate things if this application is run on a gateway machine and not infact the machine that is running the game.
Since my game only supports multiplayer over internet via a matchmaking service, i need to know that im listening to the internet connected address.
Does anyone have any better suggestion on how to solve this?
Look at the last parameter passed to RegQueryValueEx().
This variable needs to be initialized to the size of the return buffer, in BYTES (NOT characters).
On return, this variable will be set to the number of bytes copied to the buffer, including null terminators.
the CViewLeft derived from CView, the CEditViewRight derived from CEditView, both them have OnDraw() function, but after debugging, only go into CViewLeft OnDraw(), not go into CEditViewRight OnDraw() , what's the matter?
The edit view never has to draw anything, as its all covered up by an edit control - and *that* does it's own drawing.
No idea. You'd best step into the CreateView functions and see why. I'd guess that one of the form view's dialogs aren't creating properly.
Try it with a very boring form view, with only a "hello world" static control, and build up from there.
hi can any body tell me how to add libraries in C++ using visual studio 2005
i downloaded JXTA-C and this requires APR ,OpenSSL ,zlib ,sqlite3 ,xml2 and expat but im not sure how to add them in Visual studio
Can you elaborate when you say that i am comparing apples to oranges?
Why do people insist on comparing C++ and Java? Consider reading The Design and Evolution of C++ (D&E) to see why C++ is the way it is, and consider both languages in the light of their design criteria. Those criteria will obviously differ from the criteria of Sun's Java team. Despite the syntactic similarities, C++ and Java are very different languages. In many ways, Java seems closer to Smalltalk than to C++.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
For one, how can you verify that the loops were fully processed without some output of the value in the end?
You need to modify a value on each iteration, and use the final value in some output in both systems to prevent optimizations in Java from throwing the whole loop away and not even processing it. You may be the victim of a false positive since it may not have processed things as you think in both environments. You need to understand what happens in optimized and debug modes to properly set up your benchmarks and to fully appreciate and digest the results of your tests.
You can inadvertantly benchmark using debug mode so make sure, if you haven't already, to only benchmark in releasemode.
Last Visit: 31-Dec-99 19:00 Last Update: 3-Dec-21 9:29