home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_02_02 / 2n02050a < prev    next >
Text File  |  1990-12-30  |  843b  |  33 lines

  1.  
  2. #include        <string.h>
  3. #include        "netbios.h"
  4.  
  5. /*****************************************************
  6. * max_dg - Determine largest acceptable datagram size
  7. * Parameters:
  8. * Returns: Maximum valid datagram size in bytes
  9. * Notes: This code assumes that you are using a memory
  10. *        model which will result in buffer being a far
  11. *        pointer.
  12. * History: Original code by William H. Roetzheim, 1990
  13. ******************************************************/
  14.  
  15. int max_dg()
  16. {
  17.    struct  net_control_block  ncb;
  18.    int length = 0;
  19.  
  20.    init_ncb(&ncb);
  21.    while (ncb.retcode == 0)
  22.    {
  23.        length++;
  24.        init_ncb(&ncb);
  25.        ncb.command = NCB_SEND_DATAGRAM;
  26.        ncb.length = length;
  27.        ncb.number = 0x01; /* use adapter standard name */
  28.        int_netbios(&ncb);
  29.    }
  30.    return length -1;
  31. }
  32.  
  33.