Add safe connect, fix possible seg fault in RTC
[ric-plt/lib/rmr.git] / docs / user-guide.rst
old mode 100755 (executable)
new mode 100644 (file)
index cc84a2c..c201dcb
@@ -1,4 +1,5 @@
  
 .. This work is licensed under a Creative Commons Attribution 4.0 International License. 
 .. SPDX-License-Identifier: CC-BY-4.0 
 .. CAUTION: this document is generated from source in doc/src/rtd. 
@@ -6,6 +7,7 @@
 .. Do NOT make changes directly to .rst or .md files. 
  
  
 RMR User's Guide 
 ============================================================================================ 
  
@@ -51,10 +53,16 @@ The rmr_alloc_msg function is used to allocate a buffer which
 the user programme can write into and then send through the 
 RMR library. The buffer is allocated such that sending it 
 requires no additional copying out of the buffer. If the 
-value passed in size is 0, then the default size supplied on 
-the *rmr_init* call will be used. The *ctx* parameter is the 
-void context pointer that was returned by the *rmr_init* 
-function. 
+value passed in size is less than or equal to 0, then the 
+*normal maximum size* supplied on the *rmr_init* call will be 
+used. When *size* is greater than zero, the message allocated 
+will have at least the indicated number of bytes in the 
+payload. There is no maximum size imposed by RMR, however the 
+underlying system memory managerment (e.g. malloc) functions 
+may impose a limit. 
+The *ctx* parameter is the void context pointer that was 
+returned by the *rmr_init* function. 
  
 The pointer to the message buffer returned is a structure 
 which has some user application visible fields; the structure 
@@ -410,7 +418,7 @@ application when rmr_rcv_msg is invoked. These messages are
 returned in the order received, one per call to rmr_rcv_msg. 
  
 Call Timeout 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The rmr_call function implements a timeout failsafe to 
 prevent, in most cases, the function from blocking forever. 
@@ -424,14 +432,14 @@ environment where there is heavy message traffic.
  
 When the threshold number of messages have been queued 
 without receiving a response message, control is returned to 
-the user application and a NULL pointer is returned to 
+the user application and a nil pointer is returned to 
 indicate that no message was received to process. Currently 
 the threshold is fixed at 20 messages, though in future 
 versions of the library this might be extended to be a 
 parameter which the user application may set. 
  
 Retries 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The send operations in RMR will retry *soft* send failures 
 until one of three conditions occurs: 
@@ -457,13 +465,13 @@ A retry loop consists of approximately 1000 send attempts
 **without** any intervening calls to *sleep()* or *usleep().* 
 The number of retry loops defaults to 1, thus a maximum of 
 1000 send attempts is performed before returning to the user 
-application. This value can be set at any point after RMr 
+application. This value can be set at any point after RMR 
 initialisation using the *rmr_set_stimeout()* function 
 allowing the user application to completely disable retires 
 (set to 0), or to increase the number of retry loops. 
  
 Transport Level Blocking 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The underlying transport mechanism used to send messages is 
 configured in *non-blocking* mode. This means that if a 
@@ -489,7 +497,7 @@ RETURN VALUE
  
 The rmr_call function returns a pointer to a message buffer 
 with the state set to reflect the overall state of call 
-processing (see Errors below). In some cases a NULL pointer 
+processing (see Errors below). In some cases a nil pointer 
 will be returned; when this is the case only *errno* will be 
 available to describe the reason for failure. 
  
@@ -556,9 +564,9 @@ must be set.
      int retries_left = 5;               // max retries on dev not available
      int retry_delay = 50000;            // retry delay (usec)
      static rmr_mbuf_t*  mbuf = NULL;    // response msg
-     msg_t*  pm;                         // private message (payload)
+     msg_t*  pm;                         // application struct for payload
      // get a send buffer and reference the payload
-     mbuf = rmr_alloc_msg( mr, RMR_MAX_RCV_BYTES );
+     mbuf = rmr_alloc_msg( mr, sizeof( pm->req ) );
      pm = (msg_t*) mbuf->payload;
      // generate an xaction ID and fill in payload with data and msg type
      snprintf( mbuf->xaction, RMR_MAX_XID, "%s", gen_xaction() );
@@ -671,6 +679,59 @@ rmr_fib(3), rmr_has_str(3), rmr_tokenise(3), rmr_mk_ring(3),
 rmr_ring_free(3) 
  
  
+NAME 
+-------------------------------------------------------------------------------------------- 
+rmr_get_const 
+SYNOPSIS 
+-------------------------------------------------------------------------------------------- 
+:: 
+  
+ #include <rmr/rmr.h>
+ unsigned char* rmr_get_const();
+DESCRIPTION 
+-------------------------------------------------------------------------------------------- 
+The rmr_get_const function is a convenience function for 
+wrappers which do not have the ability to "compile in" RMR 
+constants. The function will build a nil terminated string 
+containing JSON which defines the RMR constants that C and Go 
+applications have at compile time via the rmr.h header file. 
+All values are represented as strings and the JSON format is 
+illustrated in the following (partial) example: 
+:: 
+  
+ {
+   "RMR_MAX_XID": "32",
+   "RMR_OK": "0",
+   "RMR_ERR_BADARG", "1",
+   "RMR_ERR_NOENDPT" "2"
+ }
+RETURN VALUE 
+-------------------------------------------------------------------------------------------- 
+On success, a pointer to a string containing the JSON 
+defining constant and value pairs. On failure a nil pointer 
+is returned. 
+SEE ALSO 
+-------------------------------------------------------------------------------------------- 
+rmr(7) 
 NAME 
 -------------------------------------------------------------------------------------------- 
  
@@ -810,7 +871,8 @@ function. Error checking has been omitted for clarity.
      rmr_mbuf_t* msg = NULL;
      int nready;
      int i;
-     mrc = rmr_init( "43086", RMR_MAX_RCV_BYTES, RMRFL_NONE );
+     int norm_msg_size = 1500;               // 95% messages are less than this
+     mrc = rmr_init( "43086", norm_msg_size, RMRFL_NONE );
      rcv_fd = rmr_get_rcvfd( mrc );
      ep_fd = epoll_create1( 0 );             // initialise epoll environment
      epe.events = EPOLLIN;
@@ -863,14 +925,14 @@ DESCRIPTION
  
 The rmr_get_src function will copy the *source* information 
 from the message to a buffer (dest) supplied by the user. In 
-an RMr message, the source is the sender's information that 
+an RMR message, the source is the sender's information that 
 is used for return to sender function calls, and is generally 
 the hostname and port in the form *name*. The source might be 
 an IP address port combination; the data is populated by the 
 sending process and the only requirement is that it be 
 capable of being used to start a TCP session with the sender. 
  
-The maximum size allowed by RMr is 64 bytes (including the 
+The maximum size allowed by RMR is 64 bytes (including the 
 nil string terminator), so the user must ensure that the 
 destination buffer given is at least 64 bytes. 
  
@@ -929,19 +991,19 @@ DESCRIPTION
  
 The rmr_get_srcip function will copy the *source IP address* 
 from the message to a buffer (dest) supplied by the user. In 
-an RMr message, the source IP address is the sender's 
+an RMR message, the source IP address is the sender's 
 information that is used for return to sender function calls; 
 this function makes it available to the user application. The 
 address is maintained as IP:port where *IP* could be either 
 an IPv6 or IPv4 address depending on what was provided by the 
 sending application. 
  
-The maximum size allowed by RMr is 64 bytes (including the 
+The maximum size allowed by RMR is 64 bytes (including the 
 nil string terminator), so the user must ensure that the 
 destination buffer given is at least 64 bytes. The user 
-application should use the RMr constant RMR_MAX_SRC to ensure 
+application should use the RMR constant RMR_MAX_SRC to ensure 
 that the buffer supplied is large enough, and to protect 
-against future RMr enhancements which might increase the 
+against future RMR enhancements which might increase the 
 address buffer size requirement. 
  
 RETURN VALUE 
@@ -1155,7 +1217,7 @@ SYNOPSIS
 :: 
   
  #include <rmr/rmr.h>
- void* rmr_init( char* proto_port, int max_msg_size, int flags );
+ void* rmr_init( char* proto_port, int norm_msg_size, int flags );
  
  
  
@@ -1169,20 +1231,34 @@ which provides the necessary routing information for the RMR
 library to send messages. 
  
 *Port* is used to listen for connection requests from other 
-RMR based applications. The *max_msg_size* parameter is used 
-to allocate receive buffers and is the maximum message size 
-which the application expects to receive. This value is the 
-sum of **both** the maximum payload size **and** the maximum 
-trace data size. This value is also used as the default 
-message size when allocating message buffers. Messages 
-arriving which are longer than the given maximum will be 
-dropped without notification to the application. A warning is 
-written to standard error for the first message which is too 
-large on each connection. 
-*Flags* allows for selection of some RMr options at the time 
+RMR based applications. The *norm_msg_size* parameter is used 
+to allocate receive buffers and should be set to what the 
+user application expects to be a size which will hold the 
+vast majority of expected messages. When computing the size, 
+the application should consider the usual payload size 
+**and** the maximum trace data size that will be used. This 
+value is also used as the default message size when 
+allocating message buffers (when a zero size is given to 
+rmr_alloc_msg(); see the rmr_alloc_msg() manual page). 
+Messages arriving which are longer than the given normal size 
+will cause RMR to allocate a new buffer which is large enough 
+for the arriving message. 
+Starting with version 3.8.0 RMR no longer places a maximum 
+buffer size for received messages. The underlying system 
+memory manager might impose such a limit and the attempt to 
+allocate a buffer larger than that limit will likely result 
+in an application abort. Other than the potential performance 
+impact from extra memory allocation and release, there is no 
+penality to the user programme for specifyning a normal 
+buffer size which is usually smaller than received buffers. 
+Similarly, the only penality to the application for over 
+specifying the normal buffer size might be a larger memory 
+footprint. 
+*Flags* allows for selection of some RMR options at the time 
 of initialisation. These are set by ORing RMRFL constants 
-from the RMr header file. Currently the following flags are 
+from the RMR header file. Currently the following flags are 
 supported: 
  
  
@@ -1196,7 +1272,7 @@ RMRFL_NOTHREAD
    
   The route table collector thread is not to be started. 
   This should only be used by the route table generator 
-  application if it is based on RMr
+  application if it is based on RMR
    
  
 RMRFL_MTCALL 
@@ -1217,7 +1293,7 @@ RMRFL_NOLOCK
  
  
 Multi-threaded Calling 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The support for an application to issue a *blocking call* by 
 the rmr_call() function was limited such that only user 
@@ -1231,11 +1307,11 @@ additional support is implemented with the *rmr_mt_call()*
 and *rmr_mt_rcv()* function calls. 
  
 Multi-threaded call support requires the user application to 
-specifically enable it when RMr is initialised. This is 
+specifically enable it when RMR is initialised. This is 
 necessary because a second, dedicated, receiver thread must 
 be started, and requires all messages to be examined and 
 queued by this thread. The additional overhead is minimal, 
-queuing information is all in the RMr message header, but as 
+queuing information is all in the RMR message header, but as 
 an additional process is necessary the user application must 
 "opt in" to this approach. 
  
@@ -1527,7 +1603,7 @@ RETURN VALUE
 -------------------------------------------------------------------------------------------- 
  
 A value of 1 is returned on success, and 0 on failure. A 
-failure indicates that the RMr context (a void pointer passed 
+failure indicates that the RMR context (a void pointer passed 
 to this function was not valid. 
  
 SEE ALSO 
@@ -1588,7 +1664,7 @@ messages are returned in the order received, one per call to
 rmr_rcv_msg. 
  
 The Transaction ID 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The user application is responsible for setting the value of 
 the transaction ID field before invoking *rmr_mt_call.* The 
@@ -1603,7 +1679,7 @@ the application uses the *rmr_rts_msg()* function and does
 not adjust the transaction ID. 
  
 Retries 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The send operations in RMR will retry *soft* send failures 
 until one of three conditions occurs: 
@@ -1629,13 +1705,13 @@ A retry loop consists of approximately 1000 send attempts
 **without** any intervening calls to *sleep()* or *usleep().* 
 The number of retry loops defaults to 1, thus a maximum of 
 1000 send attempts is performed before returning to the user 
-application. This value can be set at any point after RMr 
+application. This value can be set at any point after RMR 
 initialisation using the *rmr_set_stimeout()* function 
 allowing the user application to completely disable retires 
 (set to 0), or to increase the number of retry loops. 
  
 Transport Level Blocking 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The underlying transport mechanism used to send messages is 
 configured in *non-blocking* mode. This means that if a 
@@ -1747,9 +1823,9 @@ function, and illustrates how the transaction ID must be set.
   
      int retries_left = 5;               // max retries on dev not available
      static rmr_mbuf_t*  mbuf = NULL;    // response msg
-     msg_t*  pm;                         // private message (payload)
+     msg_t*  pm;                         // appl message struct (payload)
      // get a send buffer and reference the payload
-     mbuf = rmr_alloc_msg( mr, RMR_MAX_RCV_BYTES );
+     mbuf = rmr_alloc_msg( mr, sizeof( pm->req ) );
      pm = (msg_t*) mbuf->payload;
      // generate an xaction ID and fill in payload with data and msg type
      rmr_bytes2xact( mbuf, xid, RMR_MAX_XID );
@@ -1766,7 +1842,6 @@ function, and illustrates how the transaction ID must be set.
                 mbuf->state != RMR_OK ) {
              usleep( retry_delay );
          }
-  
          if( mbuf == NULL || mbuf->state != RMR_OK ) {
              rmr_free_msg( mbuf );        // safe if nil
              return NULL;
@@ -1808,7 +1883,7 @@ DESCRIPTION
  
 The rmr_mt_rcv function blocks until a message is received, 
 or the timeout period (milliseconds) has passed. The result 
-is an RMr message buffer which references a received message. 
+is an RMR message buffer which references a received message. 
 In the case of a timeout the state will be reflected in an 
 "empty buffer" (if old_msg was not nil, or simply with the 
 return of a nil pointer. If a timeout value of zero (0) is 
@@ -1847,7 +1922,7 @@ RETURN VALUE
 -------------------------------------------------------------------------------------------- 
  
 When a message is received before the timeout period expires, 
-a pointer to the RMr message buffer which describes the 
+a pointer to the RMR message buffer which describes the 
 message is returned. This will, with a high probability, be a 
 different message buffer than *old_msg;* the user application 
 should not continue to use *old_msg* after it is passed to 
@@ -1885,7 +1960,7 @@ RMR_ERR_EMPTY
  
 RMR_ERR_NOTSUPP 
    
-  The multi-threaded option was not enabled when RMr was 
+  The multi-threaded option was not enabled when RMR was 
   initialised. See the man page for *rmr_init()* for 
   details. 
    
@@ -2071,7 +2146,7 @@ RETURN VALUE
  
 The function returns a pointer to the rmr_mbuf_t structure 
 which references the message information (state, length, 
-payload), or a NULL pointer in the case of an extreme error. 
+payload), or a nil pointer in the case of an extreme error. 
  
 ERRORS 
 -------------------------------------------------------------------------------------------- 
@@ -2242,7 +2317,7 @@ original payload are copied if the *copy* parameter is true
 there is no additional memory allocation and copying. 
  
 Cloning The Message Buffer 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 This function can also be used to generate a separate copy of 
 the original message, with the desired payload size, without 
@@ -2252,7 +2327,7 @@ parameter is true (1). When cloning, the payload is copied to
 the cloned message **only** if the *copy* parameter is true. 
  
 Message Buffer Metadata 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The metadata in the original message buffer (message type, 
 subscription ID, and payload length) will be preserved if the 
@@ -2356,7 +2431,7 @@ than this small difference, the behaviour is exactly the same
 as rmr_send_msg. 
  
 Retries 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The send operations in RMR will retry *soft* send failures 
 until one of three conditions occurs: 
@@ -2382,13 +2457,13 @@ A retry loop consists of approximately 1000 send attempts
 **without** any intervening calls to *sleep()* or *usleep().* 
 The number of retry loops defaults to 1, thus a maximum of 
 1000 send attempts is performed before returning to the user 
-application. This value can be set at any point after RMr 
+application. This value can be set at any point after RMR 
 initialisation using the *rmr_set_stimeout()* function 
 allowing the user application to completely disable retires 
 (set to 0), or to increase the number of retry loops. 
  
 Transport Level Blocking 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The underlying transport mechanism used to send messages is 
 configured in *non-blocking* mode. This means that if a 
@@ -2440,7 +2515,7 @@ RMR_OK, the user application may need to attempt a
 retransmission of the message, or take other action depending 
 on the setting of errno as described below. 
  
-In the event of extreme failure, a NULL pointer is returned. 
+In the event of extreme failure, a nil pointer is returned. 
 In this case the value of errno might be of some use, for 
 documentation, but there will be little that the user 
 application can do other than to move on. 
@@ -2503,7 +2578,7 @@ EMSGSIZE
 EFAULT 
    
   The message referenced by the message buffer is corrupt 
-  (NULL pointer or bad internal length). 
+  (nil pointer or bad internal length). 
    
  
 EBADF 
@@ -2593,7 +2668,7 @@ used by the RMR library, and not the responsibility of the
 library.) 
  
 Retries 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The send operations in RMR will retry *soft* send failures 
 until one of three conditions occurs: 
@@ -2619,13 +2694,13 @@ A retry loop consists of approximately 1000 send attempts
 **without** any intervening calls to *sleep()* or *usleep().* 
 The number of retry loops defaults to 1, thus a maximum of 
 1000 send attempts is performed before returning to the user 
-application. This value can be set at any point after RMr 
+application. This value can be set at any point after RMR 
 initialisation using the *rmr_set_stimeout()* function 
 allowing the user application to completely disable retires 
 (set to 0), or to increase the number of retry loops. 
  
 Transport Level Blocking 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The underlying transport mechanism used to send messages is 
 configured in *non-blocking* mode. This means that if a 
@@ -2660,7 +2735,7 @@ state set to indicate the reason for failure. The value of
 *errno* may also be set to reflect a more detailed failure 
 reason if it is known. 
  
-In the event of extreme failure, a NULL pointer is returned. 
+In the event of extreme failure, a nil pointer is returned. 
 In this case the value of errno might be of some use, for 
 documentation, but there will be little that the user 
 application can do other than to move on. 
@@ -2741,7 +2816,7 @@ EMSGSIZE
 EFAULT 
    
   The message referenced by the message buffer is corrupt 
-  (NULL pointer or bad internal length). 
+  (nil pointer or bad internal length). 
    
  
 EBADF 
@@ -2887,21 +2962,21 @@ DESCRIPTION
 -------------------------------------------------------------------------------------------- 
  
 The rmr_set_stimeout function sets the configuration for how 
-RMr will retry message send operations which complete with 
+RMR will retry message send operations which complete with 
 either a *timeout* or *again* completion value. (Send 
 operations include all of the possible message send 
 functions: *rmr_send_msg(), rmr_call(), rmr_rts_msg()* and 
 *rmr_wh_send_msg().* The *rloops* parameter sets the maximum 
 number of retry loops that will be attempted before giving up 
 and returning the unsuccessful state to the user application. 
-Each retry loop is approximately 1000 attempts, and RMr does 
+Each retry loop is approximately 1000 attempts, and RMR does 
 **not** invoke any sleep function between retries in the 
 loop; a small, 1 mu-sec, sleep is executed between loop sets 
 if the *rloops* value is greater than 1. 
  
  
 Disabling Retries 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 By default, the send operations will execute with an *rloop* 
 setting of 1; each send operation will attempt to resend the 
@@ -2910,7 +2985,7 @@ user application does not want to have send operations retry
 when the underlying transport mechanism indicates *timeout* 
 or *again,* the application should invoke this function and 
 pass a value of 0 (zero) for *rloops.* With this setting, all 
-RMr send operations will attempt a send operation only 
+RMR send operations will attempt a send operation only 
 **once,** returning immediately to the caller with the state 
 of that single attempt. 
  
@@ -3393,7 +3468,7 @@ RETURN VALUE
  
 The function returns a pointer to the rmr_mbuf_t structure 
 which references the message information (state, length, 
-payload), or a NULL pointer in the case of an extreme error. 
+payload), or a nil pointer in the case of an extreme error. 
  
 ERRORS 
 -------------------------------------------------------------------------------------------- 
@@ -3721,7 +3796,7 @@ potentially non-threaded concurrent applications (such as
 Go's goroutines) is possible. 
  
 Retries 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The send operations in RMR will retry *soft* send failures 
 until one of three conditions occurs: 
@@ -3747,13 +3822,13 @@ A retry loop consists of approximately 1000 send attempts
 **without** any intervening calls to *sleep()* or *usleep().* 
 The number of retry loops defaults to 1, thus a maximum of 
 1000 send attempts is performed before returning to the user 
-application. This value can be set at any point after RMr 
+application. This value can be set at any point after RMR 
 initialisation using the *rmr_set_stimeout()* function 
 allowing the user application to completely disable retires 
 (set to 0), or to increase the number of retry loops. 
  
 Transport Level Blocking 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The underlying transport mechanism used to send messages is 
 configured in *non-blocking* mode. This means that if a 
@@ -3836,7 +3911,8 @@ clarity.
          int i;
     rmr_mbuf_t*  sbuf;      // send buffer
     int     count = 0;
-    mrc = rmr_init( "43086", RMR_MAX_RCV_BYTES, RMRFL_NONE );
+    int     norm_msg_size = 1500;    // most messages fit in this size
+    mrc = rmr_init( "43086", norm_msg_size, RMRFL_NONE );
     if( mrc == NULL ) {
        fprintf( stderr, "[FAIL] unable to initialise RMR environment\\n" );
        exit( 1 );
@@ -3936,7 +4012,7 @@ DESCRIPTION
 -------------------------------------------------------------------------------------------- 
  
 The rmr_wh_open function creates a direct link for sending, a 
-wormhole, to another RMr based process. Sending messages 
+wormhole, to another RMR based process. Sending messages 
 through a wormhole requires that the connection be 
 established overtly by the user application (via this 
 function), and that the ID returned by rmr_wh_open be passed 
@@ -3944,7 +4020,7 @@ to the rmr_wh_send_msg function.
  
 *Target* is the *name* or *IP-address* combination of the 
 processess that the wormhole should be connected to. *Vctx* 
-is the RMr void context pointer that was returned by the 
+is the RMR void context pointer that was returned by the 
 rmr_init function. 
  
 When invoked, this function immediatly attempts to connect to 
@@ -4053,7 +4129,7 @@ thus any buffer allocated by these means, or calls to
 *rmr_rcv_msg()* can be passed to this function. 
  
 Retries 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The send operations in RMR will retry *soft* send failures 
 until one of three conditions occurs: 
@@ -4079,13 +4155,13 @@ A retry loop consists of approximately 1000 send attempts
 **without** any intervening calls to *sleep()* or *usleep().* 
 The number of retry loops defaults to 1, thus a maximum of 
 1000 send attempts is performed before returning to the user 
-application. This value can be set at any point after RMr 
+application. This value can be set at any point after RMR 
 initialisation using the *rmr_set_stimeout()* function 
 allowing the user application to completely disable retires 
 (set to 0), or to increase the number of retry loops. 
  
 Transport Level Blocking 
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  
 The underlying transport mechanism used to send messages is 
 configured in *non-blocking* mode. This means that if a 
@@ -4119,7 +4195,7 @@ RMR_OK, the user application may need to attempt a
 retransmission of the message, or take other action depending 
 on the setting of errno as described below. 
  
-In the event of extreme failure, a NULL pointer is returned. 
+In the event of extreme failure, a nil pointer is returned. 
 In this case the value of errno might be of some use, for 
 documentation, but there will be little that the user 
 application can do other than to move on. 
@@ -4183,7 +4259,7 @@ EMSGSIZE
 EFAULT 
    
   The message referenced by the message buffer is corrupt 
-  (NULL pointer or bad internal length). 
+  (nil pointer or bad internal length). 
    
  
 EBADF 
@@ -4244,7 +4320,8 @@ clarity.
          int i;
     rmr_mbuf_t*  sbuf;      // send buffer
     int     count = 0;
-    mrc = rmr_init( "43086", RMR_MAX_RCV_BYTES, RMRFL_NONE );
+    int     norm_msg_size = 1500;  // most msg fit in this size
+    mrc = rmr_init( "43086", norm_msg_size, RMRFL_NONE );
     if( mrc == NULL ) {
        fprintf( stderr, "[FAIL] unable to initialise RMR environment\\n" );
        exit( 1 );