Listing 1. Synchronizing the Palm

Main() {
  int sd;
  struct pi_sockaddr addr;
  sd = pi_socket(PI_AF_SLP,
         PI_SOCK_STREAM,
         PI_PF_PADP);
  addr.pi_family = PI_AF_SLP;
  strcpy(addr.pi_device, "/dev/pilot");
  pi_bind(sd, (struct sockaddr*)&addr,
        sizeof(addr));
  sd = pi_listen(sd, 1);
  sd = pi_accept(sd, 0, 0);
  printf("Yo! We have a connection...");
  pi_close(sd);
}