/* file:    lnp_reliable_brick.c
 * author:  Albert Huang <ashuang@cs.brown.edu> 
 *          touched up by Bryant Ng <bkng@cs.brown.edu>
 * date:    January, 2002
 * desc:    demonstrates lnp_reliable_printf functionality
 */


#include <lnp/lnp-reliable.h>

int main(int argc, char *argv[])
{
  int i;

  /*
   * initialize the lnp reliable protocol and tell it what 
   * address to communicate with and what port.
   *
   * should start lnp_reliable_listen program with these arguments
   * if the address is 0x80 and the port is 02
   * 
   *	lnp_reliable_listen 80 00 02
   * 
   * by default, the brick address will always be 00 unless you change
   * it with the ChangeBrickAddress program.
   * 
   */
  lnp_reliable_init(0x80, 2);
  
  lnp_reliable_printf("printf test\n");
  lnp_reliable_printf("printf test decimal %i\n", 123);
  lnp_reliable_printf("printf test negative  %i\n", -456);
  lnp_reliable_printf("printf test hex %x\n", 0xf00d);
  lnp_reliable_printf("printf test string %s\n", "string");
  lnp_reliable_printf("printf test %c char\n", 'c');

  lnp_reliable_printf("printf test %i %i %x %s %c\n", 
		               123, -456, 0xf00d, "str", 'd');

  for (i=0; i<50; i++) {
    lnp_reliable_printf("\t\t%d\n", i);
  }

  lnp_reliable_printf("prinf test finished.\n");

  lnp_reliable_shutdown();

  return 0;
};
