Hacking Connecting to a server PC with homebrew?

malucart

Well-Known Member
OP
Newcomer
Joined
Jul 24, 2016
Messages
59
Trophies
0
XP
163
Country
Brazil
My program is made up of a Wii U side and a PC side, but I can't seem to connect (via network ofc).
I do it just like Cafiine - on the C# app, AcceptTcpClient() on a TcpListener, and on the Wii U app, connect() a socket (resumed; there's some initialization too).

It doesn't connect at all though. I put some output, and it says "Connect error! Socket OK!"
Now seriously wtf? If the socket is OK why doesn't it connect?

Can someone help me? I promise, you will like the result.
 
D

Deleted User

Guest
It might help if I could see the code on the Wii U side of things.
I was able to get sockets to connect earlier, but wasn't able to send 8-bit data through them (it always ended up being $$$ signs on the Wii U).

Where does it say "Connect error?" The Wii U or the PC?
 

malucart

Well-Known Member
OP
Newcomer
Joined
Jul 24, 2016
Messages
59
Trophies
0
XP
163
Country
Brazil
On the Wii U, the PC just stays there "Listening for connections on port 7333". As I said, I do it just like Cafiine.

I use this:
Code:
int server_connect(int *psock, const char* server_ip) {
    struct sockaddr_in addr;
    int sock, ret;

    // No ip means that we don't have any server running, so no logs
    if (server_ip == 0) {
        *psock = -1;
        return 0;
    }

    socket_lib_init();

    sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if(sock < 0)
        return sock;

    addr.sin_family = AF_INET;
    addr.sin_port = 7333;
    addr.sin_addr.s_addr = server_ip;

    ret = connect(sock, (void *)&addr, sizeof(addr));
    if(ret < 0)
    {
        socketclose(sock);
        return -1;
    }

    int enable = 1;
    setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char*)&enable, sizeof(enable));

    *psock = sock;
    iLock = 0;
    return 0;
}

To check I do this:
Code:
int* sock = -1;
int res = server_connect(sock, "192.168.0.8");
OSFatal(strcat(res < 0? "Connect error!" : "Connected!", sock < 0? " Socket error!" : " Socket OK!"));
 
D

Deleted User

Guest
I won't be able to test this on my own console, and probably won't be able to until Friday, but I think what's happening (in terms of your error code) is that you're concatenating the results of two separate errors.

In your case, you're trying to check for the result of whether the socket connected successfully, and then conatenating it with the result of the actual socket connection, which results in the "Connect error! Socket OK."

Not sure what's actually going wrong with the actual sockets, everything looks correct to me. I'm probably missing something, but I don;t really have time to thoroughly study the code. Sorry.
 

nexusmtz

Well-Known Member
Member
Joined
Feb 17, 2016
Messages
1,386
Trophies
0
XP
1,425
Country
United States
My program is made up of a Wii U side and a PC side, but I can't seem to connect (via network ofc).
It doesn't connect at all though. I put some output, and it says "Connect error! Socket OK!"
Now seriously wtf? If the socket is OK why doesn't it connect?

...
Code:
...
    sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
    if(sock < 0)
        return sock;
...
    ret = connect(sock, (void *)&addr, sizeof(addr));
    if(ret < 0)
    {
        socketclose(sock);
        return -1;
    }
...

To check I do this:
Code:
int* sock = -1;
int res = server_connect(sock, "192.168.0.8");
OSFatal(strcat(res < 0? "Connect error!" : "Connected!", sock < 0? " Socket error!" : " Socket OK!"));
Keep in mind that you get the socket before you tell it what remote address and port you're trying to connect to. It makes sense that the socket can be valid on the WiiU, but the connection can fail. You might want to change the order of the messages so they don't appear contradictory. Also, if getting the socket fails, you don't get to the connect part (res is actually sock), so the message is misleading in that case too.

Anyway, check your PC firewall to ensure that your new app and port are allowed, and do a wireshark capture to see if any packets are getting from the WiiU to the PC so you know which side the problem is on.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
  • K3Nv2 @ K3Nv2:
    That aren't $8,000
    +1
  • BigOnYa @ BigOnYa:
    I just ordered one these, got tired of bunch of external drives for dif game systems game backups (Some require FAT32, some NTFS), so wanna combine them
    51fz1bsUEnL._AC_SL1500_.jpg
  • Xdqwerty @ Xdqwerty:
    just use a usb or a sd card
  • Xdqwerty @ Xdqwerty:
    its more small
  • Xdqwerty @ Xdqwerty:
    in physical size
  • BigOnYa @ BigOnYa:
    Lol
  • K3Nv2 @ K3Nv2:
    Thought about one of those but I don't really use hdds like that
    +1
  • K3Nv2 @ K3Nv2:
    Does it cap out at a certain tb
  • BigOnYa @ BigOnYa:
    no, i can switch to which drive I want to access with a button on it, I have 4 2tb and 1 4tb, all dif formats, so will work good for me
  • K3Nv2 @ K3Nv2:
    So you could have a petabyte with it
  • BigOnYa @ BigOnYa:
    You made me go back and look, it says 32tb max per drive. It will be nice when setting up game systems, I can carry one enclosure around, instead of grabbing the right Ext hdd for, say Xbox360 games
  • K3Nv2 @ K3Nv2:
    So about 128tb still more than you'd ever need
    +1
  • BigOnYa @ BigOnYa:
    I thought about just buying a new ext hdd 12tb like you shown, then format multiple partitions on it, but I'm lazy.
  • K3Nv2 @ K3Nv2:
    Buy 4 won't have to
    +1
  • BigOnYa @ BigOnYa:
    It was only $75 so still cheaper than a new drive. And less hassle. It would take forever to copy everything over also.
  • K3Nv2 @ K3Nv2:
    You take forever
  • BigOnYa @ BigOnYa:
    That's what uremum says...
    +1
  • K3Nv2 @ K3Nv2:
    To do her chores yes
  • K3Nv2 @ K3Nv2:
    Anything else she says you finish in two minutes
    +1
  • BigOnYa @ BigOnYa:
    Dusting and cleaning those windows take forever, and I can never get those stains out of her bed sheets. And that damn doorbell ringing all the time, men coming and going constantly
    +1
  • Xdqwerty @ Xdqwerty:
    installing retroarch in my pc again
    +1
  • K3Nv2 @ K3Nv2:
    She's a woman that gets things done most have big strong men over to accomplish things
    +1
  • BigOnYa @ BigOnYa:
    I like retroarch, once you set it up completely, it's cool. Artwork, summary, and screen shots for all your games is a nice touch. It's basically a organizer for all your emulators/games.
    +1
  • Xdqwerty @ Xdqwerty:
    install done
  • Xdqwerty @ Xdqwerty:
    start setting up
    Xdqwerty @ Xdqwerty: start setting up