CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  网络编程

各位老大:谁有netbios协议的例子程序.发一个给小弟,急用.

楼主yuanlin13(yy)2004-12-03 16:49:39 在 VC/MFC / 网络编程 提问

各位老大,用IPX/netbios和tcp/ip的netbios的使用有什么不同的地方吗? 问题点数:100、回复次数:5Top

1 楼yuanlin13(yy)回复于 2004-12-03 16:50:51 得分 0

e_mail:yuanlin13@tom.comTop

2 楼Caps77(厉兵秣马)回复于 2004-12-03 17:12:01 得分 10

《windows网络编程技术》第一章Top

3 楼kingzai(stevenzhu)回复于 2004-12-03 17:42:04 得分 10

http://www.homenethelp.com/web/faq/network-netbeui.aspTop

4 楼oyljerry(【勇敢的心】→ ㊣提拉米苏√㊣)回复于 2004-12-03 19:12:08 得分 80

#include   <windows.h>  
  #include   <stdio.h>  
  #include   <stdlib.h>  
  #include   <string.h>  
   
  #include   <nb30.h>  
   
  int   Recv(int   lana,   int   lsn,   char   *buffer,   WORD   *len);  
  int   Send(int   lana,   int   lsn,   char   *data,   WORD   len);  
  int   AddName(int   lana,   char   *name,   int   *num);  
  int   DelName(int   lana,   char   *name);  
  int   AddGroupName(int   lana,   char   *name,   int   *num);  
  int   ResetAll(LANA_ENUM   *lenum,   UCHAR   ucMaxSession,    
            UCHAR   ucMaxName,   BOOL   bFirstName);  
  int   LanaEnum(LANA_ENUM   *lenum);  
  int   Hangup(int   lana,   int   lsn);  
  int   Cancel(PNCB   pncb);  
  int   FormatNetbiosName(char   *nbname,   char   *outname);  
   
  int   LanaEnum(LANA_ENUM   *lenum)  
  {  
          NCB                                 ncb;  
   
          ZeroMemory(&ncb,   sizeof(NCB));  
          ncb.ncb_command   =   NCBENUM;  
          ncb.ncb_buffer   =   (PUCHAR)lenum;  
          ncb.ncb_length   =   sizeof(LANA_ENUM);  
   
          if   (Netbios(&ncb)   !=   NRC_GOODRET)  
          {  
                  printf("ERROR:   Netbios:   NCBENUM:   %d\n",   ncb.ncb_retcode);  
                  return   ncb.ncb_retcode;  
          }  
          return   NRC_GOODRET;  
  }  
   
  //  
  //   Reset   each   LANA   listed   in   the   LANA_ENUM   structure.   Also,   set  
  //   the   NetBIOS   environment   (max   sessions,   max   name   table   size),  
  //   and   use   the   first   NetBIOS   name.  
  //  
  int   ResetAll(LANA_ENUM   *lenum,   UCHAR   ucMaxSession,    
                            UCHAR   ucMaxName,   BOOL   bFirstName)  
  {  
          NCB                                 ncb;  
          int                                 i;  
   
          ZeroMemory(&ncb,   sizeof(NCB));  
          ncb.ncb_command   =   NCBRESET;  
          ncb.ncb_callname[0]   =   ucMaxSession;  
          ncb.ncb_callname[2]   =   ucMaxName;  
          ncb.ncb_callname[3]   =   (UCHAR)bFirstName;  
   
          for(i   =   0;   i   <   lenum->length;   i++)  
          {  
                  ncb.ncb_lana_num   =   lenum->lana[i];  
                  if   (Netbios(&ncb)   !=   NRC_GOODRET)  
                  {  
                          printf("ERROR:   Netbios:   NCBRESET[%d]:   %d\n",  
                                  ncb.ncb_lana_num,   ncb.ncb_retcode);  
                          return   ncb.ncb_retcode;  
                  }  
          }  
          return   NRC_GOODRET;  
  }  
   
  //  
  //   Add   the   given   name   to   the   given   LANA   number.   Return   the   name  
  //   number   for   the   registered   name.  
  //  
  int   AddName(int   lana,   char   *name,   int   *num)  
  {  
          NCB                                 ncb;  
   
          ZeroMemory(&ncb,   sizeof(NCB));  
          ncb.ncb_command   =   NCBADDNAME;  
          ncb.ncb_lana_num   =   lana;  
          memset(ncb.ncb_name,   '   ',   NCBNAMSZ);  
          strncpy(ncb.ncb_name,   name,   strlen(name));  
   
          if   (Netbios(&ncb)   !=   NRC_GOODRET)  
          {  
                  printf("ERROR:   Netbios:   NCBADDNAME[lana=%d;name=%s]:   %d\n",  
                          lana,   name,   ncb.ncb_retcode);  
                  return   ncb.ncb_retcode;  
          }  
          *num   =   ncb.ncb_num;  
          return   NRC_GOODRET;  
  }  
   
  //  
  //   Add   the   given   NetBIOS   group   name   to   the   given   LANA  
  //   number.   Return   the   name   number   for   the   added   name.  
  //  
  int   AddGroupName(int   lana,   char   *name,   int   *num)  
  {  
          NCB                                 ncb;  
   
          ZeroMemory(&ncb,   sizeof(NCB));  
          ncb.ncb_command   =   NCBADDGRNAME;  
          ncb.ncb_lana_num   =   lana;  
          memset(ncb.ncb_name,   '   ',   NCBNAMSZ);  
          strncpy(ncb.ncb_name,   name,   strlen(name));  
   
          if   (Netbios(&ncb)   !=   NRC_GOODRET)  
          {  
                  printf("ERROR:   Netbios:   NCBADDGRNAME[lana=%d;name=%s]:   %d\n",  
                          lana,   name,   ncb.ncb_retcode);  
                  return   ncb.ncb_retcode;  
          }  
          *num   =   ncb.ncb_num;  
          return   NRC_GOODRET;  
  }  
   
  //  
  //   Delete   the   given   NetBIOS   name   from   the   name   table   associated  
  //   with   the   LANA   number  
  //  
  int   DelName(int   lana,   char   *name)  
  {  
          NCB                                 ncb;  
   
          ZeroMemory(&ncb,   sizeof(NCB));  
          ncb.ncb_command   =   NCBDELNAME;  
          ncb.ncb_lana_num   =   lana;  
          memset(ncb.ncb_name,   '   ',   NCBNAMSZ);  
          strncpy(ncb.ncb_name,   name,   strlen(name));  
   
          if   (Netbios(&ncb)   !=   NRC_GOODRET)  
          {  
                  printf("ERROR:   Netbios:   NCBADDNAME[lana=%d;name=%s]:   %d\n",  
                          lana,   name,   ncb.ncb_retcode);  
                  return   ncb.ncb_retcode;  
          }  
          return   NRC_GOODRET;  
  }  
  Top

5 楼yuanlin13(yy)回复于 2004-12-06 09:34:01 得分 0

在没有现成的服务器和客户端的例子.Top

相关问题

  • 各位老大!帮帮忙啊!着急用呢!谢谢!!!!!!!!!!
  • 各位老大救急,用TServerSocket中转文件的问题
  • 谁有网页中实现n级树的例子,急用
  • 谁有动态打印的例子,急用
  • 那位兄弟给我发个.net的platformSDK里的iocp例子。急用!!!
  • 请教高手:DTS参数传递,谁能给小弟个例子?很急用!
  • 急用
  • 急用
  • 急用
  • 急用!!!!!

关键词

  • ncb
  • lana
  • goodret
  • lenum
  • netbios
  • nrc
  • retcode
  • lsn
  • enum
  • num

得分解答快速导航

  • 帖主:yuanlin13
  • Caps77
  • kingzai
  • oyljerry

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo