Solved

Netbios programming problem

Posted on 1997-08-08
2
513 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 50 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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Sometimes you might need to configure routing based not only on destination IP address, but also on a combination of destination IP address (or hostname) and destination port number. I will describe a method how to accomplish this with free tools. …
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…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
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…

691 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