Hi,
I have got this code below from Jeff Loucks on how to set my connection to a
nonblocking state.
Int16 SetSocketBlocking(NetSocketRef s, Boolean fBlocking)
{
// Blocking flag
Int16 option = fBlocking ? 0 : 1;
// Set socket blocking or nonBlocking
return NetLibSocketOptionSet(
NetLibRefnum,
s,
netSocketOptLevelSocket,
netSocketOptSockNonBlocking,
&option,
sizeof(option),
NetLibTimeout,
&NetLibErrno
);
}
but i dnt know why, when i used it in my code it still blocks, and the error
would be errWouldBlock.
below is where i used the nonblocking funtion:
NetLibSocketBind (NetLibP->AppNetRefnum,
NetLibP->MasterSocket,
(NetSocketAddrType *)&NetLibP->MasterAddr,
sizeof(NetLibP->MasterAddr),
NetLibP->AppNetTimeout,
&err);
if(err != 0) {
StrPrintF(ErrorCode, "Error code: %x", err);
FrmCustomAlert(AlertID, "NetLibSocketBind failed to open!",
(Char*)ErrorCode, "");
goto CloseMasterSocket;
}
err = SetSocketBlocking(NetLibP, MasterSocketType, false);
if(err != 0)
goto CloseMasterSocket;
is there any error in my code?
thanks,
Emilio
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/