I posted this to comm-dev-forum last week but there's not a lot of activity 
over there.  I still haven't gotten the netSocketOptSockNotice to work 
properly.  I believe I am doing everything properly, using the 
NetSocketNoticeType structure with NetLibSocketOptionSet(), but I can't help 
but think it is some type of struct packing issue.  Though I have tried to 
squirm the struct and size to make it work, but haven't had success.

Has anyone worked with socket notices yet?  SDK-5 added this stuff in 
NetMgr.h which I presume only works for OS 5 and beyond.  For some reason I 
am always getting sysErrParamErr from the NetLibSocketOptionSet() within the 
simulator, which is the only OS 5 platform I have for use.

    NetSocketNoticeType nsnt;

    /* set activity callback */
    MemSet(&nsnt, sizeof(nsnt), 0);
    nsnt.type = netSocketNoticeCallback;
    nsnt.condition = netSocketNoticeTCPReceive;
    nsnt.notice.callback.callbackP = my_socket_callback;
    nsnt.notice.callback.userDataP = NULL;
    if (NetLibSocketOptionSet(AppNetRefnum, sock, netSocketOptLevelSocket,
        netSocketOptSockNotice, &nsnt, sizeof(nsnt), AppNetTimeout, &errno))
        ShowErrorMsg(ErrToString(errno));

Err my_socket_callback(void *userDataP, UInt16 socketRef, UInt32 condition)
{
    return 0;
}

I would like to use these nifty socket features for background networking, 
rather than the hideous method of using a periodic timer to poll the sockets.

-- 
/* Chris Faherty <[EMAIL PROTECTED]> */

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

Reply via email to