1

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.

reuben
  • 3,360
  • 23
  • 28
Tyler McMaster
  • 1,407
  • 2
  • 14
  • 15
  • If there's a *lot* of code, you're doing the right thing in not including all of it. It would be helpful, however, if you could provide a high-level explanation of what you've tried, or possibly code excerpts that you're worried about... – reuben Jul 08 '12 at 21:47

1 Answers1

0

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.

tolik518
  • 119
  • 2
  • 14
x-x
  • 7,287
  • 9
  • 51
  • 78
  • I ran debug but it is not reading the entire response. It is reading though. HTTP Is 200 OK. And it detects 404. – Tyler McMaster Jul 09 '12 at 16:46
  • Try making a small test app on the PC that connects and receives some data. Verify that it works correctly. Then replace the socket functions with the devkitPPC/libogc equivalents and test it on the Wii, using the example templates here: http://devkitpro.git.sourceforge.net/git/gitweb.cgi?p=devkitpro/wii-examples;a=tree;f=template;h=5f21fc5378ca14577baed9c5fe68a76ed97b67ff;hb=HEAD – x-x Jul 09 '12 at 22:21
  • Okay, Sending all data, And receiving all data. I'm giving up with this project. I'll start a new one that may be doable at some point. The code works, However its the site that i need to access that IS NOT sending accurate data. I could make a proxy, But all that just for a wii app? no thanks, i'll drop the project – Tyler McMaster Jul 10 '12 at 02:43