Hello Guilherme,
Though replying late, but I would like to type in few lines.
NetLibClose() function call has a second parameter called 'Immediate'. If you set this parameter to value 'true' then you dont need to use NetLibFinishCloseWait() call.
Instead, if you set this parameter to false, only then probably, you may need to call NetLibFinishCloseWait() depending on your application.
Sanjay
On 3/21/06, Guilherme C. Hazan <[EMAIL PROTECTED]> wrote:
Hi,
I've used this code to close a connection:
ok = NetLibSocketClose(PALM_REFNUM(refNum) socketRef, timeout, &err) == 0;
Then someone told me that i would have to do this:
if (NetLibSocketShutdown(PALM_REFNUM(refNum) socketRef, netSocketDirOutput, timeout,
&err) == 0)
{
// cleanup the receiving buffer
byte bytes[64];
int32 n = 1;
debug("socket close 1");
do
{
int i = 4;
while (--i)
{
n = NetLibReceive(PALM_REFNUM(refNum) socketRef, bytes, 64, 0, 0, 0, timeout,
&err);
debug(int2str("socket close 2: ",err));
if (!(n == -1 && err == 4626)) // if was a timeout, try again
break;
}
debug(int2str("socket close 3: ",n));
} while (n > 0);
}
NetLibSocketShutdown(PALM_REFNUM(refNum) socketRef, netSocketDirInput, timeout, &err);
ok = NetLibSocketClose(PALM_REFNUM(refNum) socketRef, timeout, &err) == 0;
But this is still not working. Now i found this:
NetLibClose
and also this function:
NetLibFinishCloseWait
Can a gentleman tell me what's the correct and safe way to close a socket?
thanks
guich
--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
-- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
