STCP/transport.c
static void control_loop(mysocket_t sd, context_t *ctx)
{
  assert(ctx);
  assert(!ctx->done);
  
  while (!ctx->done)
  {
    unsigned int event;
    
    /* see stcp_api.h or stcp_api.c for details of this function */
    /* XXX: you will need to change some of these arguments! */
    event = stcp_wait_for_event(sd, 0, NULL);
    
    /* check whether it was the network, app, or a close request */
    if (event & APP_DATA)
    {
      /* the application has requested that data be sent */
      /* see stcp_app_recv() */
    }
    
    /* etc. */
  }
}
/* control_loop() is the main STCP loop; it repeatedly waits for one of the
 * following to happen:
 *   - incoming data from the peer
 *   - new data from the application (via mywrite())
 *   - the socket to be closed (via myclose())
 *   - a timeout
 */
control_loop() is the main STCP loop; it repeatedly waits for one of the
following to happen:
- incoming data from the peer
- new data from the application (via mywrite())
- the socket to be closed (via myclose())
- a timeout
control_loop () is the main STCP loop ; it repeatedly waits for one of the following to happen : - incoming data from the peer - new data from the application ( via mywrite () ) - the socket to be closed ( via myclose () ) - a timeout
static void control_loop(mysocket_t sd, context_t *ctx)
{
  assert(ctx);
  assert(!ctx->done);
  while (!ctx->done)
  {
    unsigned int event;
    event = stcp_wait_for_event(sd, 0, NULL);
    if (event & APP_DATA)
    {
    }
  }
}
static void control_loop ( mysocket_t sd , context_t * ctx ) { assert ( ctx ) ; assert ( ! ctx -> done ) ; while ( ! ctx -> done ) { unsigned int event ; event = stcp_wait_for_event ( sd , 0 , NULL ) ; if ( event & APP_DATA ) { } } }
control_loop() is the main STCP loop; it repeatedly waits for one of the
 following to happen:
   - incoming data from the peer
   - new data from the application (via mywrite())
   - the socket to be closed (via myclose())
   - a timeout
control_loop () is the main STCP loop ; it repeatedly waits for one of the following to happen : - incoming data from the peer - new data from the application ( via mywrite () ) - the socket to be closed ( via myclose () ) - a timeout
/* see stcp_api.h or stcp_api.c for details of this function */ /* XXX: you will need to change some of these arguments! */ /* check whether it was the network, app, or a close request */ /* the application has requested that data be sent */ /* see stcp_app_recv() */ /* etc. */