[Samba] [NetBIOS] Registering new name?
Gilles Ganault
gilles.ganault at bigfoot.com
Tue Aug 21 12:29:04 GMT 2007
Hello
I'm having a hard time finding information about NetBIOS. Maybe someone
here has good experience with this API, so I figured I could try asking
here, although the question is specifically on how to use NetBIOS in an
all-Windows LAN from Visual Basic :-/
I'm trying to register a new name on a server so that clients can locate it
by broadcasting its NetBIOS name.
At this point, this little VB code does register the name successfully, but
it's not listed in "net name" and "net send" to it fails:
======
Private Sub Command1_Click()
Dim ncbInfo As NCB
Dim sMachine As String * NCBNAMSZ
Dim bRet As Byte
'===========1. Send RESET
With ncbInfo
.ncb_command = NCBRESET
End With
bRet = Netbios(ncbInfo)
MsgBox ncbInfo.ncb_retcode, , ncbInfo.ncb_num
'===========2. Register name
sMachine = SERVER_NAME & Chr(3)
With ncbInfo
.ncb_command = NCBADDNAME
.ncb_name = sMachine
'.ncb_lana_num = &H0
End With
bRet = Netbios(ncbInfo)
MsgBox ncbInfo.ncb_retcode, , ncbInfo.ncb_num
'Can't use net send
'C:\>nbtstat -n
'
' FRED <03> UNIQUE Registered
' MY_GREAT_SERVER<03> UNIQUE Registered
'
'C:\>net name
'Name
'-----------------------------------------------------------------
'MYPUTER
'FRED
'The command completed successfully.
'
'C:\>net send fred test
'The message was successfully sent to FRED.
'
'C:\>net send my_great_server test
'An error occurred while sending a message to MY_GREAT_SERVER.
'
'The message alias could not be found on the network.
'C:\>ping my_great_server
'Ping request could not find host my_great_server. Please check the
name and try
'again.
'
'C:\>ping fred
'Ping request could not find host fred. Please check the name and try
again.
'===========3. Have client hosts send broadcast to locate
'===========4. Clients connect to \\MY_GREAT_SERVER\pipes\mypipe" to
tx/rx data
End Sub
==========
Any idea why it's not working?
Thank you.
More information about the samba
mailing list