Welcome! Log In Create A New Profile

Advanced

network.h incomplete?

Posted by laserbeak43 
network.h incomplete?
May 26, 2010 08:44AM
Hello,
I'm looking at network.h and I'm seeing some things that look incomplete.
#ifndef htons
#define htons(x) (x)
#endif
that's the only time you see htons in the .h file. and it doesn't seem to exist anywhere else in the libogc folder either.
Am i missing something?
I don't see any UDP examples for the wii, so i'm trying to use a UDP example for windows, using its equivalent for the wii. but i can't seem to find
some things.

another question, is network.h for wii setup to work like the windows socket headers?

your help would be greatly appreciated,
thanks
Re: network.h incomplete?
May 26, 2010 09:25AM
In regards to the htons macro, that is valid. The htons macro/function is used to convert an integer from the host byte order to network byte order. As the Wii is big endian byte order, and network byte order is also big endian, the macro leaves the integer alone. On a little endian machine the htons macro/function would swap the byte order of the supplied integer.
htons = Host to Network Short
More info...



Edited 1 time(s). Last edit at 05/26/2010 09:30AM by DrTwox.
Re: network.h incomplete?
May 26, 2010 09:56AM
ok, so then that means if i did need to swap byte order from a PC program, I'd need to do that in the PC program's code? That makes sense I(i,the noob) guess.
Another question, It seems like everything is declared, but nothing is defined. there's no network.c or anything like that, so how do i learn how all of these functions work?
s32 net_ioctl(s32 s, u32 cmd, void *argp);
s32 net_fcntl(s32 s, u32 cmd, u32 flags);
s32 net_poll(struct pollsd *sds,s32 nsds,s32 timeout);
s32 net_shutdown(s32 s, u32 how);
these all return type s32 integers but only have a parameter list. what is supposed to be in the returned value?

-edit-
I am looking at the network example in \devkitPro\examples\wii\devices\network\sockettest
but like the header file, the functions have no definition. I guess this is where someone suggests I read up on some C-syntax literature?
These aren't inline functions are they? I can't say i've ever seen this style before. Is it that these functions are compiled in the lib files? that'd suck cause i don't see any documentation for them.



Edited 1 time(s). Last edit at 05/26/2010 09:59AM by laserbeak43.
Re: network.h incomplete?
May 26, 2010 04:43PM
The net_* functions work about the same as Nix/Win32 networking. Main difference is the functions directly return errors usually instead of through errno. For documentation, google for the network function with the "net_" prefix removed. libogc is a library. The definition for all the functions etc, are in the sourceforge devkitpro libogc SVN.
Re: network.h incomplete?
May 26, 2010 05:53PM
oh so devkitpro uses precompiled libs? ok thanks i'll look at the SVN. Thanks a ton guys! :)

-edit-
so can i use the winsock documentation(if it exists) to understand network.h?



Edited 1 time(s). Last edit at 05/26/2010 06:06PM by laserbeak43.
Re: network.h incomplete?
May 27, 2010 06:15PM
Quote
laserbeak43
so can i use the winsock documentation(if it exists) to understand network.h?
Yeah you can use any socket documentation for network.h documentation.
Re: network.h incomplete?
May 27, 2010 06:35PM
Thanks :)
Sorry, only registered users may post in this forum.

Click here to login