[Stk] Re: how does incoming TCP/IP data trigger your socket?

Gary Scavone gary@music.mcgill.ca
Fri, 23 Jan 2004 17:36:41 -0500 (EST)


Hi Andreas,

>   Do your communication classes Messager and Socket DEMAND a server-side 
>   global runtime LOOP in main() to receive from a client over a socket
>   by  "type = messager->nextMessage();" ?

The Messager class was created primarily for the demo application and 
will probably not be useful in more general contexts.  The socket 
class is just a wrapper around standard socket functions.  It can be 
used to create a socket server or establish a connection to a server 
as a client.

> > Or to put it the other way around: 
>   Does the operating system socket routine send some signal whenever 
>   there is incoming data - and DOES your library catch that signal? 
>   WHERE is that implemented in your library?

You can check out the code ... it's relatively basic.  For example, 
the "readBuffer" function just calls the standard socket function 
"recv" (which you can read about in the man pages).

> Or a third formulation of the same idea:
>   Where could I put "_one_line_of_code_" to inform MY program 
>   of incoming TCP/IP - SKINI data so that it starts a 
>   "messager->nextMessage()" until the buffer is empty again?

You'll need to design an "interrupt" strategy, though you can probably 
do it using the socket or other classes.

Hope that helps!  Thanks for the thanks.  :-)

--gary