Link to home
Start Free TrialLog in
Avatar of mimicrosoft
mimicrosoft

asked on

netbios(NCB)

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
 
ASKER CERTIFIED SOLUTION
Avatar of stefanr
stefanr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mimicrosoft
mimicrosoft

ASKER

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
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.