SNMP Manager Programmer's Guide
Programming Examples
SNMP Manager Programmer’s Guide–134249
2-28
Managers Supporting UDP and IPC
 if (err != 0)
 {
  host_int->err_num = err; /* Save the error number */
  if (PRINT_DEBUG_MSG)
  {
   fprintf(stdout, "Encoding packet failed with error %i.\n", err);
  }
  return ENCODE_FAILED;
 }
 temp_file_num = host_int->file_num;
 if (PRINT_SEND_MSG) <--37
 {
  fprintf(stdout, "\nSENDING PACKET:\n");
  print_pkt(spkt);
 }
 /* Send current contents of the ebuffer */
 send_cnt = EBufferUsed(&myEBuff); <--38
 if(host_int->local_flag == REMOTE_HOSTNAME) <--39
 {
  /* Using remote access (D20 sockets) */
  /* Prefix the buffer with the destination socket address */
  memcpy (ebuffp->start_bp, (void*) &host_int->dest,
   sizeof(struct sockaddr_in));
  send_cnt += sizeof(struct sockaddr_in);
  if ((err = t_sendto_nw(host_int->file_num,
   (struct sendto_recvfrom_buf*) ebuffp->start_bp,
   send_cnt, 0, 0)) == -1)
  {
   host_int->err_num = err;  /* Save the error number */
   if (PRINT_DEBUG_MSG)
   {
   fprintf(stdout, "T_SENDTO_NW returned error %i.\n", err);
   }
   return WRITE_FAILED;
  }
Example 2-2. Contents of snmpfsc (page 15 of 19)










