?
Solved

Netbios programming problem

Posted on 1997-08-08
2
Medium Priority
?
523 Views
Last Modified: 2013-12-19
I've made a litle program using netbios (3.0) which normally can read the network id adapter. I have the following problem when i try to get the id I have the error 0x5 from the netbios this is NB_COMMAND_TIME_OUT. I don't know how to resolv this one.
I give the source.
##########################################################
To use this change <IP_ADRESS> by the Ip adress of your machine.
##########################################################
   #include <windows.h>
   #include <nb30.h>
   #include <wincon.h>
   #include <stdlib.h>
   #include <stdio.h>
   #include <time.h>
   #include <string.h>

   typedef struct _ASTAT_
   {
      ADAPTER_STATUS adapt;
      NAME_BUFFER    NameBuff [30];
   }ASTAT, * PASTAT;
 
   ASTAT Adapter;  

   void main (void)
   {
      NCB Ncb;
      UCHAR uRetCode;
 
      memset( &Ncb, 0, sizeof(Ncb) );
      Ncb.ncb_command = NCBRESET;
     
 
      uRetCode = Netbios( &Ncb );
      if (uRetCode == 0){
        printf( "The NCBRESET Ok!!\n");
      }
 
      memset( &Ncb, 0, sizeof (Ncb) );
      Ncb.ncb_command = NCBASTAT;
      strcpy( (char*)Ncb.ncb_callname, <IP_ADRESS> );
      Ncb.ncb_buffer = (unsigned char *) &Adapter;
      Ncb.ncb_length = sizeof(Adapter);
      uRetCode = Netbios( &Ncb );
 
      printf( "The NCBASTAT return code is: 0x%x \n", uRetCode );
      if ( uRetCode == 0 )
      {
         printf( "The Ethernet Number is: %02x%02x%02x%02x%02x%02x\n",
                  Adapter.adapt.adapter_address[0],
                  Adapter.adapt.adapter_address[1],
                  Adapter.adapt.adapter_address[2],
                  Adapter.adapt.adapter_address[3],
                  Adapter.adapt.adapter_address[4],
                  Adapter.adapt.adapter_address[5] );
      }
   }

If you have an idea to resolv my problem?
or If you can give me a source to read the ID network adapter I'm very happy.

Best regards,
0
Comment
Question by:es071097
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 5

Expert Comment

by:y96andha
ID: 1563055
Try changing
 strcpy( (char*)Ncb.ncb_callname, <IP_ADRESS> );
to
 strcpy( (char*)Ncb.ncb_callname,"*               "); // one asterisk and 15 blanks

0
 
LVL 5

Accepted Solution

by:
y96andha earned 100 total points
ID: 1563056
You can also look at http://www.experts-exchange.com/topics/bin/ShowQ?qid=8630010494 which is a VB source for getting the MAC address.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Greetings, Experts! First let me state that this website is top notch. I thoroughly enjoy the community that is shared here; those seeking help and those willing to sacrifice their time to help. It is fantastic. I am writing this article at th…
Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question