I misspoke - the socket is not always non-blocking. You would normally use
non-blocking for async connect, listen and sometimes for read and write.

A link to sample code is available through the knowledge base in an article
announcing Socket Notices for OS 5.4.0.

--------------------
Jeff Loucks
Work 425-284-1128 [EMAIL PROTECTED]
Mobile 253-691-8812 [EMAIL PROTECTED]
Home 253-851-8908 [EMAIL PROTECTED]
 

-----Original Message-----
From: Jeffry Loucks [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 18, 2004 12:05 PM
To: Palm Developer Forum
Subject: RE: Net Socket Notification

I see they've announced socket notices (netSocketNoticeNotify) as a new
feature of OS5.2! Interesting, since it's been part of the OS since May of
2000!

Socket Notices allow for asynchronous sockets. You open a non-blocking
socket, and then set the notice to fire on a certain set of conditions
(connection, data available, error, closure, etc.). When the conditions are
met, the notification you specify is broadcast (deferred).

Of the five socket notice options, only netSocketNoticeNotify can be used
from a PACE app on OS5. I suspect that the other four options work for ARM
native apps, but when they ported the OS from 68K to ARM, socket notices
didn't receive the endianess and PACE<>ARM glue attention it needed. Could
be that netSocketNoticeNotify works by accident, since
SysNotifyBroadcastDeferred() works for both PACE and ARM.

You'll need to register a notification receiver and then call EvtGetEvent(),
since the notifications are sent from NetLib with
SysNotifyBroadcastDeferred(), which are broadcast from EvtGetEvent().

The option argument passed in NetLibSocketOptionSet() in this case is the
address of a void pointer which points to the NetSocketNoticeType. Kind of
confusing.

Also, note that socket notices are one-shot and must be reset after each
trigger.

Sample socket setup:

Int16 OS_async(SOCKET sock, UInt32 condition)
        {
        NetSocketNoticeType notice;
        void *option;

        notice.condition = condition;
        notice.type = netSocketNoticeNotify;
        notice.notice.notify.notifyType = kAsyncNotifyType;
        option = &notice;
        if (NetLibSocketOptionSet(
                        NetLibRefnum,
                        sock,
                        netSocketOptLevelSocket,
                        netSocketOptSockNotice,
                        &option,
                        sizeof(option),
                        NetLibTimeout,
                        &NetLibErrno))
                {
                SP_TRACE("OS_async() cannot set socket notice:
%x",NetLibErrno);
                return -1;
                }
        return 0;
        }

Hope this helps.
Jeff

--------------------
Jeff Loucks
Work 425-284-1128 [EMAIL PROTECTED]
Mobile 253-691-8812 [EMAIL PROTECTED]
Home 253-851-8908 [EMAIL PROTECTED]
 

-----Original Message-----
From: Wendel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 18, 2004 4:33 AM
To: Palm Developer Forum
Subject: Net Socket Notification

Hi,
 
Please, how can I use the structures of notification and callback to NetLib?
There in NetMgr.h structures like SysNotifyNetSocketType,
NetSocketNoticeEventType, NetSocketNoticeType, etc, but I don't know anyone
of these types. Where I can to find information about this?
 
Thanks.
Ricardo Wagner Brito



--------------------------------------------------------------------------
WebMail Secrel (C) - www.secrel.com.br

   


-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to