Hi Emilio,
Sorry, but your question is unclear to me.
Which call still blocks? You mention errWouldBlock. A blocking call
will return errWouldBlock to tell you it would have blocked, but did
not. In other words, a NetLib call will return the error errWouldBlock
right away without blocking, if it would have blocked had you not set
it to non-blocking.
I presume by this:
err = SetSocketBlocking(NetLibP,MasterSocketType, false);
you meant this:
err = SetSocketBlocking(NetLibP->MasterSocket, false);
What part of the code either blocks, or gives you errWouldBlock?
jeff
On 7/17/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
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/
--
yisdersomenimororsisasisdenderisorsis?
Jeff Loucks
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/