Hacking Connecting to a server PC with homebrew?

malucart

Well-Known Member
OP
Newcomer
Joined
Jul 24, 2016
Messages
60
Trophies
0
XP
178
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
60
Trophies
0
XP
178
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,435
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.
  • Sicklyboy @ Sicklyboy:
    bout to buy me some prescription safety glasses
  • K3Nv3 @ K3Nv3:
    Got eye insurance? Some do custom laser cutting engraving same day in office
  • Sicklyboy @ Sicklyboy:
    I do but the optometrist I got my glasses at last year was expensive as fuck even WITH my insurance, so I'm gonna order on Zenni and see if my insurance will reimburse it. And if they won't, then, oh well, still will be cheaper anyway
  • Sicklyboy @ Sicklyboy:
    $90 for the safety glasses on Zenni, vs my daily wear glasses were >$200 after insurance
  • K3Nv3 @ K3Nv3:
    Haven't been to the eye doc in like 3 years but was pretty surprised they cut the glass in office had the in like an hour ready
  • Sicklyboy @ Sicklyboy:
    That's pretty sweet, I had to wait like a week or so for mine to be ready
  • Sicklyboy @ Sicklyboy:
    Lookin at buying another pair of regular glasses too. And maybe prescription sunglasses
  • K3Nv3 @ K3Nv3:
    Yeah most just ship off to a lab could always call around to see if new ones have in office glass cutters
  • Sicklyboy @ Sicklyboy:
    too much effort + im shy and social anxiety :( lmao
  • K3Nv3 @ K3Nv3:
    I just wear them when I drive cause I'd like to actually read signs
  • K3Nv3 @ K3Nv3:
    Think they said I'm far sighted or some bs
  • Sicklyboy @ Sicklyboy:
    My eyes aren't that bad, I need mine for driving but ever since I got my latest pair I wear them all the time when I'm home now, I never used to before
  • Sicklyboy @ Sicklyboy:
    I'm near sighted though
  • K3Nv3 @ K3Nv3:
    I feel like docs just say you're this and that for the insurance claims half the time
    +1
  • Sicklyboy @ Sicklyboy:
    But even my computer monitors, that are like 3ft away when I'm leaning back in my chair, so much easier to see now with my glasses than without
  • Sicklyboy @ Sicklyboy:
    Doc was cool though, he measured my old glasses and I wanted to try different contacts than I had had previously and he's like "hmmm I bet you're this strength and that strength" and damn dude was dead on the money
  • Sicklyboy @ Sicklyboy:
    lmao that clip
  • K3Nv3 @ K3Nv3:
    Know a guy who did laser surgery for like 2g but argued you'd never need glasses again
  • Sicklyboy @ Sicklyboy:
    laser eye surgery scares me
  • Sicklyboy @ Sicklyboy:
    The thought of any kind of surgery shit being done on my eyes gives me unbelievable amounts of dread and anxiety, and with the potential risks or side effects that laser eye surgery has, I don't think my eyes are bad enough to warrant it. I can see without my glasses - not great, but not bad either.
  • K3Nv3 @ K3Nv3:
    Yeah I feel that if it gets to the point where all I see is blurry then I might consider if
  • Skelletonike @ Skelletonike:
    Just do it like in Minority Report. Won't feel a thing.
    K3Nv3 @ K3Nv3: https://www.aliexpress.us/item/3256806249264202.html?spm=a2g0n.home.rcmd.4.468a76dbbdxITc&gps-id=...