Sign in to follow this  
Followers 0
ACalcutt

UPNP AV Media server?

7 posts in this topic

I just got a Dlink DSM 320 and have been looking for a good media server. my favorite so far has been http://www.tversity.com/.

but i was wondering if it would be possible to make my own server in autoit. i would have no idea how i would do this, but does anyone here have an idea


Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Share this post


Link to post
Share on other sites



:lmao: That would be quite a project from what I gather... If it was me, I'd google around for code of anyone else who might have done it(in autoit or any other language you can understand). If I couldn't find anything, I'd pick apart the Dlink media server that you can download off the site to see how it works. Maybe use their dll(if that's how it works) and just make your own interface or something. Sorry if that doesn't help much...

Share this post


Link to post
Share on other sites

I just got a Dlink DSM 320 and have been looking for a good media server. my favorite so far has been http://www.tversity.com/.

but i was wondering if it would be possible to make my own server in autoit. i would have no idea how i would do this, but does anyone here have an idea

I was looking around with the same idea :) , currently there are already projects that could make this happen:

WebServer:

http://www.autoitscript.com/forum/index.ph...=nfwu+webserver

Implementing HTML Skins:

http://www.autoitscript.com/forum/index.php?showtopic=30564

UPnP Implementation:

Now we come to the part where i'm stuck. <_<

for making a UPnP compliant webserver, we need to broadcast with SSDP.

The best article i found so far is from Zac Bowling.

I was hoping that someone could point me in the direction of how to broadcast packets with UDP to adress 239.255.255.250:1900

with message:

M-SEARCH * HTTP/1.1
Host:239.255.255.250:1900
ST:upnp:rootdevice
Man:\"ssdp:discover\"
MX:3

---

PS: My personal favourite Upnp AV Media server is WIZD

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@all

UDPStartUp()

$start = 1

$socket = UDPbind("127.0.0.1", 65000) 
; OR ??
$socket = UDPOpen("239.255.255.250", 1900)

ConsoleWrite($socket[1] & "|" & $socket[2] & "|" & $socket[3] & @LF & @LF)

$cmd  = 'M-SEARCH * HTTP/1.1' & @CR
$cmd &= 'Host:239.255.255.250:1900' & @CR
$cmd &= 'ST:upnp:rootdevice' & @CR
$cmd &= 'Man:ssdp:discover' & @CR
$cmd &= 'MX:3' & @CR
$cmd &= @CR
$cmd &= @CR

ConsoleWrite($cmd & @LF)

UDPSend($socket, $cmd)
sleep (2000)
UDPSend($socket, $cmd)

While (1)
   ; If ($start = 1) Then
        $srcv = UDPRecv($socket, 512)
        If ($srcv <> "") Then
            ConsoleWrite("Received Response" & @CR)
            ConsoleWrite($srcv & @CR)
        EndIf
   ; EndIf
WEnd

Func OnAutoItExit()
    UDPCloseSocket($socket)
    UDPShutdown()
EndFunc

I am not sure about the UDPBind or UDPOpen to do the broadcast ?

Please test and let us know if it works ?

regards

ptrex

Edited by ptrex

Share this post


Link to post
Share on other sites

Thx Ptrex.

I skipping the UPnP Protocol, as this is only available for Windows XP.

I've managed to get the SSDP Broadcast, and my Linksys router is reponding to my broadcast.

The problem now, is that the repons is going back to the source port of my broadcast.

How can we find out what my source port is when i do a "UDPSend" to a predefined destination port.

$p = ""
$p = $p & "M-SEARCH * HTTP/1.1" & @CRLF
$p = $p & "Host:239.255.255.250:1900" & @CRLF
$p = $p & "ST:upnp:rootdevice" & @CRLF
$p = $p & "Man:" & """" & "ssdp:discover" & """" & @CRLF
$p = $p & "MX:3" & @CRLF
$p = $p & @CRLF


UDPStartup()

;==============================================
$socket = UDPOpen("239.255.255.250", 1900)
If @error <> 0 Then 
    MsgBox(0,"Error","Unable to Bind")
    Exit
EndIf

$n=0

While 1
    
    If $n < 4 Then 
        $status = UDPSend($socket, $p)
        If $status = 0 then 
            MsgBox(0, "ERROR", "Error while sending UDP message: " & @error)
            Exit
        EndIf
    EndIf
    
    Sleep(1000)
    
    $data = UDPRecv($socket, 50)
    If $data <> "" Then
        MsgBox(0, "UDP DATA", $data, 1)
        Exit
    EndIf
    
    
    $n = $n + 1
    
WEnd

Func OnAutoItExit()
    UDPCloseSocket($socket)
    UDPShutdown()
EndFunc

How did i found out that my router is reponding?, Microsoft Network Monitor 3.1

Any Ideas how to proceed?

Share this post


Link to post
Share on other sites

@Home Bunny

Sorry for the late reply but I was abroad all week, though life :P

$p = ""
$p = $p & "M-SEARCH * HTTP/1.1" & @CRLF
$p = $p & "Host:239.255.255.250:1900" & @CRLF
$p = $p & "ST:upnp:rootdevice" & @CRLF
$p = $p & "Man:" & """" & "ssdp:discover" & """" & @CRLF
$p = $p & "MX:3" & @CRLF
$p = $p & @CRLF


UDPStartup()

;==============================================
$socket = UDPOpen("192.168.1.1", 1900)  ; Here is where you have to point to the address of you device in your network
If @error <> 0 Then 
    MsgBox(0,"Error","Unable to Bind")
    Exit
EndIf

$n=0

While 1
    
    If $n < 4 Then 
        $status = UDPSend($socket, $p)
        If $status = 0 then 
            MsgBox(0, "ERROR", "Error while sending UDP message: " & @error)
            Exit
        EndIf
    EndIf
    
    Sleep(1000)
    
    $data = UDPRecv($socket, 50)
    If $data <> "" Then
        MsgBox(0, "UDP DATA", $data, 1)
        Exit
    EndIf
    
    
    $n = $n + 1
    
WEnd

Func OnAutoItExit()
    UDPCloseSocket($socket)
    UDPShutdown()
EndFunc

Try this code again filling in the IP address of your device in you network where I have indicated this.

It's good that you went all the way down to the protocol level . I must admid that I did the same thing after a while.

Regards,

ptrex

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0