Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Oct 19, 2017 4:01 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: udpsocket and SQL Server question
PostPosted: Fri Apr 19, 2013 5:33 am 
Offline

Joined: Fri Feb 27, 2009 12:18 am
Posts: 54
Hi,

i need to enumerate instances of MS SQL Server on a network.
i have been reading that the discovery is done by UDP broadcastin &h02 on port 1434

i have tried to find an example of how this is done, but i cant find one.

i have tried :-


udpsocket1.port = 1434
udpsocket1.NetworkInterface = system.GetNetworkInterface(0)


udpsocket1.connect

if udpsocket1.isconnected then
udpsocket1.write(udpsocket1.broadcastaddress,chr(2))
end if


but i get "invalid port error"

please can anyone help with what i'm doing wrong?


Top
 Profile  
Reply with quote  
 Post subject: Re: udpsocket and SQL Server question
PostPosted: Fri Apr 19, 2013 2:52 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
udpsocket.port = portnum (must be higher than 1024)

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: udpsocket and SQL Server question
PostPosted: Mon Apr 22, 2013 4:56 am 
Offline
User avatar

Joined: Fri Oct 28, 2005 7:05 am
Posts: 565
Location: Emsworth, UK
Windows can bind to any port number. OSX, like most Nix, will prevent a process binding to ports <1024, unless run with superuser access permissions. That is not your problem though, as 1434 is > 1024.

I think it is far more likely that you're failing to bind to 1434 because there is another process already bound to 1434; SQLServer or one of it's components, for instance.

What's not explicitly mentioned in the RS documentation, is that you don't need to bind a socket to 1434 to target 1434.

Try this
UDPSocket1.Port = 30000 //or any other ephemeral port
UDPSocket1.Connect

If UDPSocket1.IsConnected Then
Dim dg as new Datagram
dg.Address = UDPSocket1.BroadcastAddress
dg.Port = 1434
dg.Data = chr(2)
UDPSocket1.Write dg
End if


Any better?

_________________
Yes it's me in the avatar


Top
 Profile  
Reply with quote  
 Post subject: Re: udpsocket and SQL Server question
PostPosted: Tue Apr 23, 2013 8:36 am 
Offline

Joined: Fri Feb 27, 2009 12:18 am
Posts: 54
Thank you msssltd,

that is exactly what i needed, its now working perfectly!!!



Kind Regards


Russ


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group