mardi 4 août 2015

Invalid handle exception

I have unit test that tests whether my functionality won't allow to use closed socket. So it looks somehow like this:

closesocket(sock);
int result;
result = getsockopt(sock,SOL_SOCKET,SO_TYPE, type, len);
if(result == SOCKET_ERROR)
    //write error etc.

On Windows platform call to getsockopt does not raise an exception "0xC0000008: An invalid handle was specified.". On Windows Phone ARM platform it raises an exception and while i can turn off the First-chance exception i cannot really turn off the uncaught exception.

Trying

try{
getsockopt();
}
catch(...)
{}

doesn't work. Is there a way I can silence this exception ?

Aucun commentaire:

Enregistrer un commentaire