Welcome! Log In Create A New Profile Wiibrew Wiki HackMii Blog

Advanced

[SOLVED] Need help with connecting to a TCP server on the internet

Posted by TheCodingBrony 
[SOLVED] Need help with connecting to a TCP server on the internet
July 29, 2015 02:13PM
Re: Need help with connecting to a TCP server on the internet
July 29, 2015 04:06PM
It would help if you said which function is failing (net_socket, net_connect etc).
Re: Need help with connecting to a TCP server on the internet
July 30, 2015 12:43AM
Oops, forgot to mention that... net_connect() is the one that kept failing. I had no issue resolving the host name and creating a socket.
Re: Need help with connecting to a TCP server on the internet
July 30, 2015 02:47AM
Re: Need help with connecting to a TCP server on the internet
July 30, 2015 05:46AM
I think it's more likely that the call to net_socket() is failing (you need to pass IPPROTO_IP for the protocol, not IPPROTO_TCP) and you're not detecting it because you only check for a result of INVALID_SOCKET. Failure is indicated by a return value that is less than zero, which will map to a constant defined in errno.h. The same goes for net_connect(), you should performing more stringent error handling than just checking for a result of -1.
Re: Need help with connecting to a TCP server on the internet
July 30, 2015 01:25PM
Well, I was finally able to get this test program to connect and download some data by following tueidj's advice and changing the port number to 80 instead of 8080 specified in my Connect() function. I'll update the code provided in the first post with the working version so that others can learn off of it when they're having similar issues.

Thanks a lot guys!

By the way tueidj, does the network library also support UDP protocol or is it TCP only? I have a feeling that its the latter since the BSD socket implementation in libogc is not exactly complete by the looks of it.



Edited 1 time(s). Last edit at 07/30/2015 01:31PM by TheCodingBrony.
Re: Need help with connecting to a TCP server on the internet
July 30, 2015 04:17PM
It's not incomplete, it just has mistakes. The wii does support UDP but libogc doesn't.
Sorry, only registered users may post in this forum.

Click here to login