TipcConnGetXtSource


Name

TipcConnGetXtSource — get source suitable for XtAppAddInput from a connection

Synopsis

T_BOOL TipcConnGetXtSource(conn, source_return) 
T_IPC_CONN conn; 
T_INT4 *source_return; 

Arguments

conn — connection to get source from

source_return — storage for source

Return Values

TRUE if source was successfully retrieved from connection, FALSE otherwise.

Diagnostics

If TipcConnGetXtSource fails, it returns FALSE and sets the global SmartSockets error number to:

Description

TipcConnGetXtSource gets an XtAppAddInput-compatible source from a connection, which allows SmartSockets IPC to be mixed with Motif or any other Xt-based widget set. Both Xt and TipcConn have their own main loop functions: XtAppMainLoop for Xt and TipcConnMainLoop for TipcConn. Because only one main loop function can be used, it is easiest to use XtAppAddInput for incorporating other sources of input into Xt’s event- handling mechanism. See the TIBCO SmartSockets User’s Guide for more information on integrating SmartSockets with Motif/Xt.

On UNIX and Windows, source_return is a socket file descriptor. On OpenVMS, source_return is an event flag in cluster zero, which is consistent with the OpenVMS implementation of XtAppAddInput.

Caution

If TipcConnGetXtSource returns FALSE, it does not store a value in source_return.

See Also

TipcConnGetSocket, TipcConnSetSocket

Examples

This example shows how to call XtAppAddInput (on both UNIX and OpenVMS):

void my_xt_func(client_data, source, id) 
XtPointer client_data; /* really (T_IPC_CONN) */ 
int *source; 
XtInputId *id; 
{ 
  T_IPC_CONN conn = (T_IPC_CONN)client_data; 
 
  /* we know we have data to read from connection */ 
  if (!TipcConnMainLoop(conn, 0.0)) { 
    return;  /* error */ 
  }  
} /* my_xt_func */ 
 
/* =========================================================== */ 
/*...code from calling function is below */ 
 
XtAppContext app_context; 
T_INT4 source; 
 
if (!TipcConnGetXtSource(conn, &source) { 
  return;  /* error */ 
} 
 
XtAppAddInput(app_context, 
              (int)source, 
#ifdef T_OS_VMS 
              NULL, 
#else 
              (XtPointer)XtInputReadMask, 
#endif 
              my_xt_func, 
              (XtPointer)conn); 

Use TipcConnMainLoop, or TipcConnMsgNext in a loop, here instead of just calling TipcConnMsgNext once. Otherwise, messages might be read in but left in the connection message queue where XtAppMainLoop cannot see them. Timeout values other than 0.0 should also be used with caution here, as a non-zero timeout can cause the process to wait for data and thus decrease the responsiveness of the Motif/Xt user interface.


TIBCO SmartSockets™ Application Programming Interface
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com