update to this:
I have initialised Radiux with 5 (just... picked it) and it won`t get out with error.
But I get strange data, when logging i get squares instead of some characters, yet some numbers are displayed, too. Who can tell me what does Radiux do ? I don`t understand from the function's description, found here: http://msdn2.microsoft.com/en-us/library/0we9x30h(VS.80).aspx
Well, I now did write sizeof(buffer) instead of fix size, and I understand the benefits, thanks to you.
I wonder how you found out about me using strlen, was just a trial (it wasn`t that obvious for me that was wrong before trying it), and I've modified the post when I`ve discovered that it doesn`t work. Indeed,learned on the hard way, strlen on a buffer is a No-No.
Thank's for the tip about zeroing the buffer before calling _ui64toa_s(). It does ring a bell, now., though in my application this part of the code comes to execution only when data exists in all fields I convert, so it's not posibile to have to convert an old value. Anyway, for future practice...
Concerning double to string, I used var-(int)var (where var was of type: double) to get the integer part (which was... int) and used _itoa_s to convert it into a string, and the rest I started multiplying by 10 (I only needed 4 digits after .) .
SYSTEMTIME is a structure type, in which all components are of type WORD. So perhaps _itoa_s() - or someone in it`s family - will do the trick.
Thanks again for all your help!
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.