dexto Posted September 26, 2010 Share Posted September 26, 2010 View Remote Screen Over Browser (MotionJPEG) Its not fast but faster then UltraVNC when it comes to games of movies. Instructions: - Make sure nothing is using port 80 on the "server" - Run ScrServ.exe on the "server" - Type "http://" & $server_name & "/" into browser (tested on firefox) - MJPEG steream shuld start and you will see remote screen - ScrServ.exe on the "server" will close after you close the page I'm sharing this for two reasons: improvement (much needed) and to give back to a great community (thx for much help in past projects)ScrServ.au3ScrServ.exe Link to comment Share on other sites More sharing options...
wakillon Posted September 27, 2010 Share Posted September 27, 2010 May be the community is sleeping...What's the utility of your script ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
dexto Posted September 27, 2010 Author Share Posted September 27, 2010 May be the community is sleeping...What's the utility of your script ?Common... opening MJPEG real time streaming just by typing the stream address... I don't know about others but I find it exciting! For one this script can be adopted to use UDP instead of TCP protocol effectively making it an instant masticating screen casting presentation station ( sounds colorful too). Link to comment Share on other sites More sharing options...
wakillon Posted September 27, 2010 Share Posted September 27, 2010 Why when I start script nothing happens ? i don't see any gui or menu... AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
dexto Posted September 27, 2010 Author Share Posted September 27, 2010 Why when I start script nothing happens ? i don't see any gui or menu...No GUI because its not really necessary. Only thing you would need to do is open your Firefox and type the computer name of IP in the address bar. The only two things that could be useful to adjust are size of the Frame and JPEG quality in %. I just didn't feel like I need GUI to do those two things. (Or may be I just wanted to use it to spy on someone..?) (evil) Then again the script is ready to be toyed with since its fairly straight forward. Link to comment Share on other sites More sharing options...
firestrife23 Posted September 28, 2010 Share Posted September 28, 2010 dexto, Nicely done! can you tell me which line to edit in the source, to not let the server die as user close the browser session, and continue listening for next connection? Thanks! Giving you 5 stars! Link to comment Share on other sites More sharing options...
dexto Posted September 28, 2010 Author Share Posted September 28, 2010 dexto, Nicely done! can you tell me which line to edit in the source, to not let the server die as user close the browser session, and continue listening for next connection?Thanks! Giving you 5 stars!Thanks! Remove "Exit" (line 60) after the line that says "_StartStream($ConnectedSocket)" Link to comment Share on other sites More sharing options...
LurchMan Posted September 28, 2010 Share Posted September 28, 2010 This is actually really cool..one thought though, you might want to add support for dual monitors. Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
dexto Posted September 28, 2010 Author Share Posted September 28, 2010 This is actually really cool..one thought though, you might want to add support for dual monitors.It would be interesting to see how it currently behaves with dual monitors, I believe it will show both monitors side by side. Link to comment Share on other sites More sharing options...
LurchMan Posted September 28, 2010 Share Posted September 28, 2010 No, it only shows the primary monitor (Dual monitors at work). Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
firestrife23 Posted September 28, 2010 Share Posted September 28, 2010 (edited) Thanks! Remove "Exit" (line 60) after the line that says "_StartStream($ConnectedSocket)"This work by preventing server from dying, however as soon I re-establish connection... it'll just keep attempting to load as if it's still waiting for the server to response with streaming feed. I suspect it may have to do with connection not being drop properly? Edited September 28, 2010 by firestrife23 Link to comment Share on other sites More sharing options...
Andreik Posted September 28, 2010 Share Posted September 28, 2010 (edited) Looks good but I cannot understand much from the photo. LE: And take a look in TaskManager at Commit Charge. Edited September 28, 2010 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
dexto Posted September 28, 2010 Author Share Posted September 28, 2010 No, it only shows the primary monitor (Dual monitors at work). How about if you change Globals $iW and $iH (lines 22,23) to: Global $iW = _WinAPI_GetSystemMetrics(78) + 1 Global $iH = _WinAPI_GetSystemMetrics(79) + 1 http://msdn.microsoft.com/en-us/library/ms724385.aspx Link to comment Share on other sites More sharing options...
LurchMan Posted September 28, 2010 Share Posted September 28, 2010 How about if you change Globals $iW and $iH (lines 22,23) to: Global $iW = _WinAPI_GetSystemMetrics(78) + 1 Global $iH = _WinAPI_GetSystemMetrics(79) + 1 http://msdn.microsoft.com/en-us/library/ms724385.aspx Awesome - That did it. Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
dexto Posted September 28, 2010 Author Share Posted September 28, 2010 This work by preventing server from dying, however as soon I re-establish connection... it'll just keep attempting to load as if it's still waiting for the server to response with streaming feed. I suspect it may have to do with connection not being drop properly?I was hoping that this is a bug in a script and unfortunately its a fault on the Firefox side from what I can see. For some reason if you press "Stop" Firefox will stop the connection and then after a second of a delay will connect to a stream in the background again! and will stay connected until you close the Firefox. On the other hand if you close the tab while is streaming Firefox will behave properly.Now, I wrote the version of the script just now that resets a current connection if it finds another connection incoming (aka reset Firefox connected in the background if you try to connect to the stream again) but it dose not feel right... if you still want that version of the script let me know. Link to comment Share on other sites More sharing options...
dexto Posted September 28, 2010 Author Share Posted September 28, 2010 (edited) Looks good but I cannot understand much from the photo. LE: And take a look in TaskManager at Commit Charge. Quality of the JPEG can be changed at "DllStructSetData($_GtData, "Quality", 80)" 80% currently. Dimensions of the picture can be changed by changing: Global $iWa = $iW / 2 Global $iHa = $iH / 2 Currently Half of the original screen size. As far as Commit Charge It loads the screen BITMAP, processing it and disposing it. Good thing its cleaning BITMAPs properly... can you imagine haw fast would it fill RAM if it was leaking? Edited September 28, 2010 by dexto Link to comment Share on other sites More sharing options...
firestrife23 Posted September 28, 2010 Share Posted September 28, 2010 (edited) I was hoping that this is a bug in a script and unfortunately its a fault on the Firefox side from what I can see. For some reason if you press "Stop" Firefox will stop the connection and then after a second of a delay will connect to a stream in the background again! and will stay connected until you close the Firefox. On the other hand if you close the tab while is streaming Firefox will behave properly. Now, I wrote the version of the script just now that resets a current connection if it finds another connection incoming (aka reset Firefox connected in the background if you try to connect to the stream again) but it dose not feel right... if you still want that version of the script let me know. You're right, I just found this snippet of codes in my autoit collection (I can't remember who to give credit to...) anyway this one will allow more than 1 connections. Feel free to reuse any part of this codes and hope this will help. expandcollapse popup#Include <GuiListView.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <inet.au3> #include <String.au3> #Include <Constants.au3> Opt("TrayMenuMode",1) Opt("WinTitleMatchMode", 2) Opt('MustDeclareVars', 0) Global $CURRENT_SOCKET Global $CONNECTED_SOCKET[3] Global $TCP_SERVER Global $SPLIT, $RECV $accept = TrayCreateItem("Accept Incoming") TrayCreateItem("") $stop = TrayCreateItem("Stop Connection") TrayCreateItem("") $close = TrayCreateItem("Close") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = $accept ReConnect() Case $msg = $stop Stop() Case $msg = $close Close() EndSelect $CONNECTED_SOCKET[$CURRENT_SOCKET] = TCPAccept($TCP_SERVER) If $CONNECTED_SOCKET[$CURRENT_SOCKET] <> -1 Then $CURRENT_SOCKET += 1 If $CURRENT_SOCKET = 2 Then TCPCloseSocket($CONNECTED_SOCKET[$CURRENT_SOCKET]) MsgBox(64, "Warning!", "Server is now Full!") EndIf EndIf For $INDEX = 0 To 2 $RECV = TCPRecv($CONNECTED_SOCKET[$INDEX],512) Next Wend Func ReConnect() TCPShutdown() $TCP = TCPStartup() $TCP_SERVER = TCPListen(@IPAddress1,7000,16) $CURRENT_SOCKET = 0 ENdFunc Func Stop() TCPCloseSocket($CONNECTED_SOCKET[$CURRENT_SOCKET]) TCPCloseSocket($TCP_SERVER) TCPShutdown() EndFunc Edited September 28, 2010 by firestrife23 Link to comment Share on other sites More sharing options...
dexto Posted September 29, 2010 Author Share Posted September 29, 2010 (edited) Thanks! Remove "Exit" (line 60) after the line that says "_StartStream($ConnectedSocket)"This work by preventing server from dying, however as soon I re-establish connection... it'll just keep attempting to load as if it's still waiting for the server to response with streaming feed. I suspect it may have to do with connection not being drop properly?You're right, I just found this snippet of codes in my autoit collection (I can't remember who to give credit to...) anyway this one will allow more than 1 connections. Feel free to reuse any part of this codes and hope this will help.Since you mentioned I rewrote it so that it allows multiple connections.Also, added connection denial of 5 sec. after connection was dropped by the browser (helps to deal with Firefox connecting in the background)We have to keep in mind that AutoIT is an enemy of multi-threading (popper way to handle TCP) and thus enemy of multi anything.So, I don't like the code with TCP multiple connections... but it works...P.S. I would LOVE to see AutotIT add Process_Fork() function ScrServMulti.au3 Edited September 29, 2010 by dexto Link to comment Share on other sites More sharing options...
LurchMan Posted September 29, 2010 Share Posted September 29, 2010 (edited) Boredom has set in at work this morning, so I added a function to detect multiple monitors and added it to your script: Func: Func _DualMonitor() $strComputer = "." $temp = 0 $objWMIService = ObjGet("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" _ & $strComputer & "\root\cimv2") $colComputers = $objWMIService.ExecQuery _ ("Select * from Win32_DesktopMonitor") For $objComputer in $colComputers $temp +=1 Next If $temp > 1 Then Return 1 Else Return 0 EndIf EndFunc ;==>_DualMonitor And changed this at the top: If _DualMonitor () Then Global $iW = _WinAPI_GetSystemMetrics(78) + 1 Global $iH = _WinAPI_GetSystemMetrics(79) + 1 Else Global $iW = _WinAPI_GetSystemMetrics(0) + 1 Global $iH = _WinAPI_GetSystemMetrics(1) + 1 EndIf Edited September 29, 2010 by LurchMan Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
firestrife23 Posted September 29, 2010 Share Posted September 29, 2010 (edited) Since you mentioned I rewrote it so that it allows multiple connections.Also, added connection denial of 5 sec. after connection was dropped by the browser (helps to deal with Firefox connecting in the background)We have to keep in mind that AutoIT is an enemy of multi-threading (popper way to handle TCP) and thus enemy of multi anything.So, I don't like the code with TCP multiple connections... but it works...P.S. I would LOVE to see AutotIT add Process_Fork() function It's working perfectly! sometime dirty hack is necessary to get desirable outcome.10+ would love to see AutoIT to become multi-thread friendly and hopefully will not be prone to race condition exploits *very common with multi-thread applications* Of course it's all in developer's hand if it was coded poorly.Thanks again! Edited September 29, 2010 by firestrife23 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now