rpc4.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <HTML>
  2. <HEAD>
  3. <TITLE>RPC4</TITLE>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. </HEAD>
  6. <link href="RaknetManual.css" rel="stylesheet" type="text/css">
  7. <meta name="title" content="RakNet - Advanced multiplayer game networking API">
  8. </HEAD>
  9. <BODY BGCOLOR="#ffffff" LINK="#003399" vlink="#003399" alink="#003399" LEFTMARGIN="0" TOPMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0"">
  10. <span style="background-color: rgb(255, 255, 255);"><img src="RakNet_Icon_Final-copy.jpg" alt="Oculus VR, Inc." width="150" height="150"></span><BR>
  11. <BR>
  12. <table width="100%" border="0"><tr>
  13. <td bgcolor="#2c5d92" class="RakNetWhiteHeader">
  14. <img src="spacer.gif" width="8" height="1">RPC4 Plugin</td>
  15. </tr></table>
  16. <TABLE BORDER="0" CELLPADDING="10" CELLSPACING="0" WIDTH="100%"><TR>
  17. <TD><p><span class="RakNetBlueHeader">Call C functions on local and remote systems.</span></p>
  18. <p> RPC4 contains mappings between string identifiers for functions, and a pointer to those functions.</p>
  19. <p><strong>Registering functions:</strong></p>
  20. <p>To Register a function, use the RegisterSlot() or RegisterBlockingFunction() members.</p>
  21. <p class="RakNetCode">void RegisterSlot(const char *sharedIdentifier, void ( *functionPointer ) ( RakNet::BitStream *userData, Packet *packet ), int callPriority);<br>
  22. bool RegisterBlockingFunction(const char* uniqueID, void ( *functionPointer ) ( RakNet::BitStream *userData, RakNet::BitStream *returnData, Packet *packet ));</p>
  23. <p>The first parameter is a string representing that function. It can be the same as the name of the function. The second parameter is a pointer to the function to be called. If it is a blocking function, the parameter list also contains a BitStream to return data to the caller.</p>
  24. <p>The class RPC4GlobalRegistration can be used to register functions where they are declared. For example:</p>
  25. <p>void CFunc1( RakNet::BitStream *bitStream, Packet *packet ) {}<br>
  26. RPC4GlobalRegistration cfunc1reg(&quot;CFunc1&quot;, CFunc1); </p>
  27. <p>If you use RPC4GlobalRegistration extensively, you may need to change RPC4_GLOBAL_REGISTRATION_MAX_FUNCTIONS to a higher number in RakNetDefines.h</p>
  28. <p><strong>Calling functions:</strong></p>
  29. <p>Use the Signal() function to call a non-blocking function. Use the CallBlocking() function otherwise.</p>
  30. <p class="RakNetCode">void Signal(const char *sharedIdentifier, RakNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, bool broadcast, bool invokeLocal);<br>
  31. bool CallBlocking( const char* uniqueID, RakNet::BitStream * bitStream, PacketPriority priority, PacketReliability reliability, char orderingChannel, const AddressOrGUID systemIdentifier, RakNet::BitStream *returnData );</p>
  32. <p>Signal will call all functions registered with that identifier using RegisterSlot(), including potentially on the same system. CallBlocking() will call a single function on a single system, registered with RegisterBlockingFunction(). CallBlocking() does not return until the remote system replies or the connection to that system is lost.</p>
  33. <p>See <em>Samples/RPC4</em> for a demonstration of this plugin</p></TD>
  34. </TR></TABLE>
  35. <table width="100%" border="0"><tr><td bgcolor="#2c5d92" class="RakNetWhiteHeader">
  36. <img src="spacer.gif" width="8" height="1">See Also</td>
  37. </tr></table>
  38. <TABLE BORDER="0" CELLPADDING="10" CELLSPACING="0" WIDTH="100%"><TR><TD>
  39. <p><A HREF="index.html">Index</A><BR>
  40. <A HREF="RPC3Video.htm">RPC3</A><a href="readyevent.html"></a><BR>
  41. </p>
  42. </TD></TR></TABLE>
  43. </BODY>
  44. </HTML>
粤ICP备19079148号