[Plib-cvs] plib/doc/net index.html,1.8,1.9
Brought to you by:
sjbaker
From: Steve B. <sj...@us...> - 2004-03-22 19:55:13
|
Update of /cvsroot/plib/plib/doc/net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5846/plib/doc/net Modified Files: index.html Log Message: Fixed some odd network library issues. Index: index.html =================================================================== RCS file: /cvsroot/plib/plib/doc/net/index.html,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- index.html 21 Mar 2004 17:12:59 -0000 1.8 +++ index.html 22 Mar 2004 19:44:50 -0000 1.9 @@ -35,7 +35,7 @@ within <code>#define</code> tokens may be separated with underscores to make them readable. <H2>Initialisation.</H2> -The first Pegasus call in any program must always be netInit(). +The first NET call in any program must always be netInit(). <H2>Classes</H2> The following class hierarchy makes up the core package - which can be extended to add functionality or to change some underlying @@ -112,6 +112,35 @@ void print ( FILE *fd = stderr ) const ; }; [...63 lines suppressed...] + sock -> open ( false ) ; + sock -> setBlocking ( false ) ; + sock -> bind ( host, port ) ; + + while ( !done ) + if ( (len = sock -> recv(msg, maxlen, 0)) >= 0 ) + ...use the data... + + sock -> close () ; +</pre> +</TD> +</TR> +</TABLE> +This code produces a 'Datagram' connection - which is fast but unreliable +(using UDP protocol). Passing a 'true' to sock->open() would produce a +'Stream' connection (using TCP). + <H2><code>class netChannel</code></h2> netChannel adds event-handling to the low-level netSocket class. Otherwise, it can be treated as |