Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Similar function to GetLastError in objective-C/C?

I'm doing some lovely socket programming in objective-C right now and part of my code is giving me an error (in the setsockopt method call). I was wondering if anyone knows of a similar function to the GetLastError() function in C++ that I could use in objective-C to determine the problem with my code?

like image 387
Josh Bradley Avatar asked Nov 21 '25 01:11

Josh Bradley


1 Answers

You want to look at the value of errno if the setsockopt returns a negative value.

From setsockopt manpage:

RETURN VALUE

Upon successful completion, setsockopt() returns 0. Otherwise, -1 is returned and errno is set to indicate the error.

You can see some standard errno values here.

like image 166
Jared Oberhaus Avatar answered Nov 23 '25 13:11

Jared Oberhaus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!