Discussion:
SSDP Simple Service Device Protocol
(too old to reply)
Silvermaine
2016-11-08 11:34:08 UTC
Permalink
i am looking to find an example if one exists that shows how to check a network and see devices avail.
apparently one would need to broadcast a UDP
M-SEARCH * HTTP/1.1\r\nMX: 5\r\nHOST: 239.255.255.250:1900

but dont know if any wrapper exists. I have searched internet for last 2 days and have been unable to find anything VB6 related.

if anyone has some code of info how to do this , i would be very grateful.

thanks

Garry
Arne Saknussemm
2016-11-08 14:14:21 UTC
Permalink
:: On Tue, 8 Nov 2016 03:34:08 -0800 (PST)
:: (microsoft.public.vb.general.discussion)
Post by Silvermaine
i am looking to find an example if one exists that shows how to check
a network and see devices avail. apparently one would need to
239.255.255.250:1900
but dont know if any wrapper exists. I have searched internet for
last 2 days and have been unable to find anything VB6 related.
if anyone has some code of info how to do this , i would be very grateful.
thanks
Here's a quick google search

http://forums.codeguru.com/showthread.php?506111-Multicast-SSDP-wrong-port

http://www.vbforums.com/showthread.php?769991-SOCKETS-How-can-i-send-a-SSDP-UPNP-packet-and-get-response

https://msdn.microsoft.com/en-us/library/aa733709(v=vs.60).aspx

and, by the way, the native libs and APIs

https://msdn.microsoft.com/en-us/library/windows/desktop/bb870632(v=vs.85).aspx

https://msdn.microsoft.com/en-us/library/windows/desktop/aa814070(v=vs.85).aspx


the problem, with VB seems to be getting back the answers, but the
above may probably give you enough stuff to, at least, start putting
together some testbed code; that said, sounds like you didn't search
enough :P
Arne Saknussemm
2016-11-08 16:21:25 UTC
Permalink
:: On Tue, 8 Nov 2016 15:14:21 +0100
:: (microsoft.public.vb.general.discussion)
Post by Arne Saknussemm
:: On Tue, 8 Nov 2016 03:34:08 -0800 (PST)
:: (microsoft.public.vb.general.discussion)
Post by Silvermaine
i am looking to find an example if one exists that shows how to
check a network and see devices avail. apparently one would need to
239.255.255.250:1900
but dont know if any wrapper exists. I have searched internet for
last 2 days and have been unable to find anything VB6 related.
if anyone has some code of info how to do this , i would be very grateful.
thanks
Here's a quick google search
http://forums.codeguru.com/showthread.php?506111-Multicast-SSDP-wrong-port
http://www.vbforums.com/showthread.php?769991-SOCKETS-How-can-i-send-a-SSDP-UPNP-packet-and-get-response
https://msdn.microsoft.com/en-us/library/aa733709(v=vs.60).aspx
and, by the way, the native libs and APIs
https://msdn.microsoft.com/en-us/library/windows/desktop/bb870632(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/aa814070(v=vs.85).aspx
the problem, with VB seems to be getting back the answers, but the
above may probably give you enough stuff to, at least, start putting
together some testbed code; that said, sounds like you didn't search
enough :P
Also

http://www.vbforums.com/showthread.php?592823-VB6-PortMapper-UPnP-NAT-Traversal-Class

http://microsoft.public.upnp.narkive.com/hBVUMC34/visual-basic-6-source-for-upnp-device-development

sounds like the Platform SDK contain(ed/s) sample code in VB too
Silvermaine
2016-11-08 22:00:38 UTC
Permalink
Post by Silvermaine
i am looking to find an example if one exists that shows how to check a network and see devices avail.
apparently one would need to broadcast a UDP
M-SEARCH * HTTP/1.1\r\nMX: 5\r\nHOST: 239.255.255.250:1900
but dont know if any wrapper exists. I have searched internet for last 2 days and have been unable to find anything VB6 related.
if anyone has some code of info how to do this , i would be very grateful.
thanks
Garry
thanks for all the replies, but i had already found most of these examples.
I understand what needs to be sent but still do not understand if it can be
done with plain VB6 or if i need some external SDK that may or may not be avail.

as i said before. I thought i could do something like

Dim host As String
Dim port As Integer
host = "239.255.255.250"
port = 1900


Winsock3.RemoteHost = host
Winsock3.RemotePort = port
Winsock3.Connect

Do While Winsock3.State <> 7

DoEvents
Loop


Winsock3.SendData "M-SEARCH * HTTP/1.1\r\nMX: 5\r\nHOST: 239.255.255.250:1900\r\nMAN: \""ssdp:discover\""\r\nST: upnp:rootdevice\r\n\r\n"

but it does not even connect.
any ideas..

Thks
Arne Saknussemm
2016-11-09 07:19:49 UTC
Permalink
:: On Tue, 8 Nov 2016 14:00:38 -0800 (PST)
:: (microsoft.public.vb.general.discussion)
Post by Silvermaine
but it does not even connect.
any ideas..
Yes, there's no "connect", you MUST use UDP, not TCP, see this and
please, revise the examples too

http://www.solidautomation.com/bryon/Using_UDP_and_Winsock_in_Visual_Basic_6.htm

you just create an UDP socket, bind it to a port and then use senddata
to sendout your UDP discovery datagram; for further detail search for
"VB6 winsock UDP" or check the help
Arne Saknussemm
2016-11-10 11:20:11 UTC
Permalink
On Wed, 9 Nov 2016 08:19:49 +0100
"Arne Saknussemm" wrote in microsoft.public.vb.general.discussion
Post by Arne Saknussemm
:: On Tue, 8 Nov 2016 14:00:38 -0800 (PST)
:: (microsoft.public.vb.general.discussion)
Post by Silvermaine
but it does not even connect.
any ideas..
Yes, there's no "connect", you MUST use UDP, not TCP, see this and
please, revise the examples too
http://www.solidautomation.com/bryon/Using_UDP_and_Winsock_in_Visual_Basic_6.htm
you just create an UDP socket, bind it to a port and then use senddata
to sendout your UDP discovery datagram; for further detail search for
"VB6 winsock UDP" or check the help
More or less, something like this (warning: AIR CODE)

' send the discovery packet
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

notice that, while I used the string format to receive the data, you
may want to change that to receive a byte array and then manipulate the
data as desired; as for the send part, the message was "translated"
from the "C" language syntax you used to the VB6 one

HTH
Silvermaine
2016-11-11 20:22:58 UTC
Permalink
Post by Silvermaine
i am looking to find an example if one exists that shows how to check a network and see devices avail.
apparently one would need to broadcast a UDP
M-SEARCH * HTTP/1.1\r\nMX: 5\r\nHOST: 239.255.255.250:1900
but dont know if any wrapper exists. I have searched internet for last 2 days and have been unable to find anything VB6 related.
if anyone has some code of info how to do this , i would be very grateful.
thanks
Garry
Hi Arne Saknussemm
Thanks for your reply. I have tried your code and also changed the IP & port numbers for ones i have seen on the internet and nothing works.
I cannot even get any data back.

I do have a Kodi device running and YATSE can auto detect it.

I realyy want to get this working if possible but really not sure how.

I just hope i am using the correct IP & Port for a Kodi device to understand.
Also that i am sending the correct msg

Will keep trying..

Loading...