[NetBIOS] Can't send msg to registered name



Hello

I'd like to have a server register a new NetBIOS name on a LAN
so that clients can locate it by broadcasting a query (this LAN has no
DNS, and no WINS). Once it is located, clients will connect to its
named pipe to tx/rx data.

Using the following VB Classic code, I can successfully register a new
name, but "net send" doesn't work:

==========
Const NCBNAMSZ = 16

Private Type NCB
ncb_command As Byte
ncb_retcode As Byte
ncb_lsn As Byte
ncb_num As Byte
ncb_buffer As Long
ncb_length As Integer
ncb_callname As String * NCBNAMSZ
ncb_name As String * NCBNAMSZ
ncb_rto As Byte
ncb_sto As Byte
ncb_post As Long
ncb_lana_num As Byte
ncb_cmd_cplt As Byte
ncb_reserve(9) As Byte
ncb_event As Long
End Type

Private Const NCBADDNAME = &H30 ' NCB ADD NAME
Private Const NCBRESET = &H32
Private Const NRC_GOODRET = &H0 ' good return
Private Const NCBSEND = &H14 ' NCB SEND

'! Name MUST be 15 characters long: if shorter, add spaces
Private Const SERVER_NAME = "MY_GREAT_SERVER"

Private Declare Function Netbios Lib "netapi32.dll" (pncb As NCB) As
Byte

Private Sub Command1_Click()
Dim ncbInfo As NCB
Dim sMachine As String * NCBNAMSZ
'Dim sMachine As String
Dim lResult As Long
Dim bRet As Byte

'sMachine = Space$(16)

'===========1. Send RESET
With ncbInfo
.ncb_command = NCBRESET
End With
bRet = Netbios(ncbInfo)
MsgBox bRet

'===========2. Register name
sMachine = SERVER_NAME & Chr(3)
With ncbInfo
.ncb_command = NCBADDNAME
.ncb_name = sMachine
.ncb_lana_num = 0
End With

bRet = Netbios(ncbInfo)
MsgBox bRet

'Can't use net send
'C:\>nbtstat -n
'
' JOE <03> UNIQUE Registered
' MY_GREAT_SERVER<03> UNIQUE Registered
'
'C:\>net name
'Name
'-----------------------------------------------------------------
'MYPUTER
JOE
'The command completed successfully.
'
'C:\>net send joe test
'The message was successfully sent to JOE.
'
'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.

'===========3. Have client hosts send broadcast to locate
'===========4. Clients connect to \\MY_GREAT_SERVER\pipes\mypipe"
to tx/rx data
End Sub

==========
Is there a step missing?

Thank you.
.



Relevant Pages

  • Re: GetProcessByName
    ... Private Const PROCESS_ALL_ACCESS = &H1F0FFF ... Private Declare Function CloseHandle Lib "kernel32" (_ ... ByVal lpBasename As String, ... Dim pbolRtn As Boolean ...
    (microsoft.public.vb.winapi)
  • Re: LoadPicture and SafeLoadImage
    ... remedied by a piece of code called SafeLoadimage which allows me to trap the error and stop the crash but does anyone ... ByVal hDC As Long, ByRef pBitmapInfo As Any, ByVal un As Long, ByRef lplpVoid As Long, _ ... Private Const JPEG_CMYK As Long = &H1000 ... Dim HeadPtr As Long, DataPtr As Long ...
    (microsoft.public.vb.winapi.graphics)
  • Re: A program is trying to access e-mail addresses...
    ... Private Const BIF_DONTGOBELOWDOMAIN As Long = &H2 ... Dim SH As Shell32.Shell ... Dim oAttachment As Outlook.Attachment ' Holds the email ... ' Make the user the folder selection dialog ...
    (microsoft.public.outlook.program_vba)
  • Re: OLE Object- the real question
    ... pszDisplayName As String ... Private Const BIF_RETURNONLYFSDIRS = &H1 ... Dim x As Long, bi As BROWSEINFO, dwIList As Long ... >> Dim strFilename As String, ...
    (microsoft.public.access.forms)
  • Access web cam with multiple web cams
    ... tuner seem to use the same driver ... Private Const WS_VISIBLE As Integer = &H10000000 ... (ByVal lpszWindowName As String, ByVal dwStyle As Integer, ByVal x As ... Dim DriverVersion As String = Space ...
    (microsoft.public.dotnet.languages.vb)