v16 Scan for Kodi devices
#1
Question 
I am programming in VB6 and trying to figure out the best way to scan for active kodi devices.
I have managed to get TCP working with json ie send and receive. Figured out how to switch
on and off.

I would really like to know how to scan a network and find kodi devices.
I have managed to do it with pinging and then testing for specific responses from kodi.
If i get a response then add to list if not move onto next ip address.

Is there any inbuilt command to get the host name that can be issued.

I have seen that a TCP UDP can be broadcast and then all kodi devices respond.
What command needs to be sent.Huh

i really need some help.

thanks
Reply
#2
UPNP is one method.
You may need an UPNP library and send a SSDP "discovery" broadcast to the network.
Then all Kodi instances respond accordingly (iirc you need to activate this in settings? tbc)
Try googling for "upnp m-search discovery example vb6" (or variants)

Also see here http://forum.kodi.tv/showthread.php?tid=221043

hth
tinyMediaManager - THE media manager of your choice :)
Wanna help translate TMM ?
Image
Reply
#3
(2016-11-07, 22:42)myron Wrote: UPNP is one method.
You may need an UPNP library and send a SSDP "discovery" broadcast to the network.
Then all Kodi instances respond accordingly (iirc you need to activate this in settings? tbc)
Try googling for "upnp m-search discovery example vb6" (or variants)

Also see here http://forum.kodi.tv/showthread.php?tid=221043

hth

hi. been searching the internet since i posted this.I cannot find anything/example ready made.

I thought i may be able to use winsock and just send the M-Search command as a UDP and get a response.

Unless anyone can point me in direction of a ready made example. I'm stumped.

thanks
Reply
#4
Here is what i have tried so far. But it does not seem to work. Am i using the correct IP & port & msg

Private Sub SendSSDP()
Dim host As String
Dim port As Integer
Dim message As String

' initialize
host = "239.255.255.250"
port = 1900
message = "M-SEARCH * HTTP/1.1" & vbCrLf & _
"MX: 5" & vbCrLf & _
"HOST: " & host & ":" & port & vbCrLf & _
"MAN: " & Chr(34) & "ssdp:discover" & Chr(34) & vbCrLf & _
"ST: upnp:rootdevice" & vbCrLf & vbCrLf

' setup the UDP socket
wsCTL.Protocol = sckUDPProtocol
wsCTL.Bind port

' send the discovery packet
wsCTL.RemoteHost = host
wsCTL.RemotePort = port
wsCTL.SendData message
End Sub

' winsock event fired on data arrival
Private Sub wsCTL_DataArrival(ByVal bytesTotal As Long)
Dim buff As String

' get the data and dump them
wsCTL.GetData buff, vbString
Debug.Print buff
End Sub
Reply

Logout Mark Read Team Forum Stats Members Help
Scan for Kodi devices0