DFHack / clsocket

SimpleSockets is a lightweight set of classes that allow developers to implement IP based network programs.
http://sockets.carrierlabs.com/
154 stars 63 forks source link

Include example covering error handling #16

Closed TheGreatRambler closed 4 years ago

TheGreatRambler commented 4 years ago

Using a simple:

networkConnection->TranslateSocketError();
CSimpleSocket::CSocketError e = networkConnection->GetSocketError();
networkConnection->DescribeError(e);

Has seemed to error every time. Also, I've been getting -1 from networkConnection->Receive() and when checking the error using the above code, the error is CSimpleSocket::CSocketError::SocketSuccess.

lethosor commented 4 years ago

What OS? Might need a larger code snippet than that - how is the snippet you posted failing?

TheGreatRambler commented 4 years ago

Nintendo Switch. Yes, Nintendo Switch. I've been able to get it to work in the past, but I've recently broken my network implementation by adding stricter error handling. I'll get back to you with my code.

lethosor commented 4 years ago

Huh. Looks like that's BSD-based? If it has the BSD networking syscalls that this library needs, I guess it makes sense that it would work, but it's unlikely that any of us would be able to test on it.

TheGreatRambler commented 4 years ago

The errors I were encountering were unrelated, turns out I'm dumb. I've had to doctor this lib a bit to get it working with switch homebrew, by the way, but it works fantastic! Love the cpp approach to sockets.

lethosor commented 4 years ago

It happens; glad it's useful! (We didn't write it originally, but it's simple enough for DFHack that we've kept it around.)