I am struggling with my code in devkitpro trying to get this program to connect to the Internet. It says it connects, it gets an IP address.
However, how do I read from the Internet and verify that it is even writing my data to the socket? This is a very tough devkit due to the lack of or quality of the documentation. I need some help on this.
EDIT: I'll post the code when asked for it. It is long and needs cleaning up.
The socket code in devkitPPC/libogc closely mirrors the BSD sockets interface. The main differences are that functions are prefixed with net_
(net_socket
, net_connect
, net_send
, etc), net_select()
is not implemented, and in most cases the error codes are returned from the functions themselves, not with errno.
If you've created a socket and connected it to a remote server, you've probably figured this out already!
However, how do I read from the Internet and verify that it is even writing my data to the socket?
The same way you would on on a PC! Open a connection with net_socket()
and net_connect()
, read and write data with net_send()
and net_revc()
, call net_close()
when done.
Check return values from these functions to determine whether the operation succeeded or failed. Most functions return < 0 when an error has occurred. You will also have to initialize the Wii network hardware and obtain an IP address first.
This is a very tough devkit due to the lack of or quality of the documentation.
Very true. Some system headers are documented using Doxygen, unfortunately network.h
isn't. However, as the interface is similar to BSD sockets, most socket tutorials or examples can be applied.
I'll post the code when asked for it. It is long and needs cleaning up.
Post some code and I'll do my best to offer more help.