[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2053.0. "Using XtAppAddInput with sockets?" by MARX::ZELTSERMAN () Tue Jan 16 1990 17:39

    I have an Ultrix application where I'd like to use
    XtAppAddInput to have an process execute when data
    is available by a socket. I'm calling XtAppAddInput
    with source = socket descripter, condition = XtInputReadMask,
    and client data = 0. A daemon process is writing data
    to the socket (input is availabel) but my procedure is not 
    being called. Any ideas on what's wrong?
    
    Dave Zeltserman
    
T.RTitleUserPersonal
Name
DateLines
2053.1TRNSAM::HOLTRobert Holt ISV Atelier WestTue Jan 16 1990 22:302
    
    Perhaps you could post the relevant parts...?
2053.2More infoMARX::ZELTSERMANWed Jan 17 1990 15:0930
    There are two pieces of the application, a DECwindows application
    and a background process. The background process gathers information
    and communicates to the DECwindows appl through a socket. The
    way I planned on having this work would be when the background
    process wrote data to the socket, the DECwindow appl would be
    able to process it by registering a callback routine (using
    XtAppAddInput) to be called on input to the socket.
    
    code :
    
                appl_context = XtCreateApplicationContext();
                XtAppAddInput(appl_context,
                              sd,       /* socket descriptor */
                              XtInputReadMask,
                              data_handler,  /* callback procedure */
                              0);
    
               
                               :
            
                XtMainloop();
    
    The background process is writing to the socket, but the
    callback procedure is not being entered. I am able to
    get this working by using a signal handler for SIGIO, but
    I'd like to know what I'm doing wrong using XtAppAddInput.
    
    Thanks, Dave Zeltserman
    
                                              
2053.3Mixing App'ls and OrangesEXLIB::DLUGOSZOpen foot, Insert MouthWed Jan 17 1990 16:1522
    One thing that I can see is that you are calling XtAppAddInput to
    register your're alternate input source and are then calling 
    XtMainLoop to do your event processing. 
    
    Either use XtAddInput or, if you must use application contexts for
    some other reason in your program - like multiple instance trees,
    then call XtAppMainLoop instead of XtMainLoop.
    
    Whatever you do, be consistent with your use of routines that take
    an application context and those that use the default application
    context (like XtInitialize, XtAddInput, and XtMainLoop).
    
    If you used XtInitialize to init the toolkit and create your top
    level shell then you already have and application context and
    don't need to create a second with XtCreateApplicationContext. 
    Use something like:
    
    	appl_context = XtWidgetToApplicationContext(top_level);
    
    to obtain the id of the default context.
    
    Ron