Thread: [Opentnl-cvs] tnl/tnl tnl.overview.txt,1.3,1.4
Brought to you by:
mark_frohnmayer,
s_alanet
From: Mark F. <mar...@us...> - 2005-05-15 22:50:18
|
Update of /cvsroot/opentnl/tnl/tnl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22723/tnl Modified Files: tnl.overview.txt Log Message: Fixed "Hello World" example in the TNL docs to reflect RPC changes. Index: tnl.overview.txt =================================================================== RCS file: /cvsroot/opentnl/tnl/tnl/tnl.overview.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** tnl.overview.txt 19 Aug 2004 21:26:32 -0000 1.3 --- tnl.overview.txt 15 May 2005 22:50:00 -0000 1.4 *************** *** 408,419 **** // declare the client to server message ! TNL_DECLARE_RPC(rpcMessageClientToServer, (const char *theMessageString)); // declare the server to client message ! TNL_DECLARE_RPC(rpcMessageServerToClient, (const char *theMessageString)); }; @endcode ! The first macro invoked, TNL_DECLARE_NETCONNECTION declares members necessary to make this class work as a connection in TNL. The RPC methods are then declared using the TNL_DECLARE_RPC macro. The first parameter to the macro is the name of the RPC method, which can be invoked like any other member function on the object. The second argument is a parenthesized argument list to the RPC. Although these functions are both declared to take only a single string, RPC method parameter lists can contain all the basic TNL types, as well as StringTableEntry, ByteBuffer and Vector objects. Next, define the implementation of the SimpleEventConnection class: --- 408,419 ---- // declare the client to server message ! TNL_DECLARE_RPC(rpcMessageClientToServer, (StringPtr theMessageString)); // declare the server to client message ! TNL_DECLARE_RPC(rpcMessageServerToClient, (StringPtr theMessageString)); }; @endcode ! The first macro invoked, TNL_DECLARE_NETCONNECTION declares members necessary to make this class work as a connection in TNL. The RPC methods are then declared using the TNL_DECLARE_RPC macro. The first parameter to the macro is the name of the RPC method, which can be invoked like any other member function on the object. The second argument is a parenthesized argument list to the RPC. Although these functions are both declared to take only a single string, RPC method parameter lists can contain all the basic TNL types, as well as StringTableEntry, ByteBufferPtr and Vector objects. Next, define the implementation of the SimpleEventConnection class: *************** *** 422,439 **** TNL_IMPLEMENT_NETCONNECTION(SimpleEventConnection, NetClassGroupGame, true); ! TNL_IMPLEMENT_RPC(SimpleEventConnection, rpcMessageClientToServer, (const char *messageString), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirClientToServer, 0) { // display the message the client sent ! printf("Got message from client: %s\n", messageString); // send a hello world back to the client. rpcMessageServerToClient("Hello, World!"); } ! TNL_IMPLEMENT_RPC(SimpleEventConnection, rpcMessageServerToClient, (const char *messageString), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirServerToClient, 0) { // display the message the server sent ! printf("Got a message from server: %s\n", messageString); // once the client has heard back from the server, it should quit. --- 422,439 ---- TNL_IMPLEMENT_NETCONNECTION(SimpleEventConnection, NetClassGroupGame, true); ! TNL_IMPLEMENT_RPC(SimpleEventConnection, rpcMessageClientToServer, (StringPtr messageString), (messageString), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirClientToServer, 0) { // display the message the client sent ! printf("Got message from client: %s\n", messageString.getString()); // send a hello world back to the client. rpcMessageServerToClient("Hello, World!"); } ! TNL_IMPLEMENT_RPC(SimpleEventConnection, rpcMessageServerToClient, (StringPtr messageString), (messageString), NetClassGroupGameMask, RPCGuaranteedOrdered, RPCDirServerToClient, 0) { // display the message the server sent ! printf("Got a message from server: %s\n", messageString.getString()); // once the client has heard back from the server, it should quit. |