Solved

netbios(NCB)

Posted on 1999-01-26
3
475 Views
Last Modified: 2013-12-03
Calling netbios(NCB) in Win98 to send a broadcast over the
LAN using NETBEUI returns without error but doesn't send
the broadcast.
The same program runs properly under DOS 6.22 by using
int 5Ch. In Win98 I call netbios(NCB) instead.
Is there something to pay attention to ?
Thanks
 
0
Comment
Question by:mimicrosoft
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
stefanr earned 200 total points
ID: 1419278
By experience from Windows NT I suspect that you are using a LANA number that is not connected to the proper protocol on the other machine(s). There is one LANA number for each one of the installed network cards AND each protocol. There is no simple way of knowing which LANA number that corresponds to which card and protocol (at least programatically). Therefore you have to test all available LANA numbers, and then use the one(s) that works, or simply broadcast on all LANA numbers in turn (the 'ncb_lana_num' member in the NCB struct).
0
 

Author Comment

by:mimicrosoft
ID: 1419279
Thank you very much for your hint. I've found the right ncb_lana_num experimentally and my test-program runs properly now.
Do you mean retrieving the wanted ncb_lana_num by using the adapter-status-command could be the right way ?

Remark:
I've found a difference to DOS, because adding the same local
name to the name-table again returns a new ncb_num  and doesn't return a duplicate-name-error as expected.

Regards,

Gerhard
0
 
LVL 3

Expert Comment

by:stefanr
ID: 1419280
It is hard to know programatically which LANA number to use when communication with different machines, so the best way is to enumerate all possible LANA numbers using the NCBENUM command, and then send to all of them in turn. I'm not sure if it works on Windows 98 though.
If not, maybe sending to the numbers 0 to 16 or some other maximum value would work. You could perhaps test which numbers works by checking the return code. If it is NRC_BRIDGE it would mean that the LANA number is invalid. I think that the numbers are consecutive, so the first invalid number would exclude all higher numbers too.
I do not think that the NCBSSTAT command would be so useful in this case, since it is used when the LANA number is known already.
If you were using a stream connection instead of a broadcast, the method above could be refined further. After having found the valid LANA numbers, you can test which LANA number(s) that is actually connected to the remote application by doing some custom handshaking. Send a custom message to each one of the valid LANA numbers, and let the remote application send back a custom ACK message on the LANA number(s) on that machine where the message were received. Then you could select a single LANA number on each machine (the LANA numbers are most likely different on each one) to communicate between them.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

746 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now