Platforms to show: All Mac Windows Linux Cross-Platform

/Win/Windows QOS/Windows QOS


Required plugins for this example: MBS Win Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Win/Windows QOS/Windows QOS

This example is the version from Wed, 26th Nov 2013.

Project "Windows QOS.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Close() sock.Close sock = nil End EventHandler
EventHandler Sub Open() dim url as string = "http://www.macsw.de/plugin/ChartDirectorPresentation.pdf" sock = new MyHTTPSocket sock.get url End EventHandler
Property sock As MyHTTPSocket
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyHTTPSocket Inherits HTTPSocket
EventHandler Function AuthenticationRequired(Realm As String, Headers As InternetHeaders, ByRef Name As String, ByRef Password As String) As Boolean log CurrentMethodName End EventHandler
EventHandler Sub Connected() log CurrentMethodName #if TargetWin32 then dim r as Boolean FlowId = 0 // new flow r = qos.AddSocketToFlow(me.Handle, qos.QOSTrafficTypeExcellentEffort, qos.QOSNonAdaptiveFlow, FlowId) if not r then log "Error: "+qos.LasterrorMessage else log "FlowID: "+str(FlowId) end if dim Bandwidth as UInt64 = 1024 * 1024 // 1 MBit dim ShapingBehavior as integer = qos.QOSUseNonConformantMarkings dim Reason as integer = qos.QOSFlowRateUserCaused r = qos.setOutgoingRate(FlowID, Bandwidth, ShapingBehavior, Reason) if not r then log "Error: "+qos.LasterrorMessage end if #endif End EventHandler
EventHandler Sub DownloadComplete(url as string, httpStatus as integer, headers as internetHeaders, file as folderItem) log CurrentMethodName End EventHandler
EventHandler Sub Error(code as integer) log CurrentMethodName+": "+str(code) End EventHandler
EventHandler Sub HeadersReceived(headers as internetHeaders, httpStatus as integer) log CurrentMethodName End EventHandler
EventHandler Sub PageReceived(url as string, httpStatus as integer, headers as internetHeaders, content as string) log CurrentMethodName log "httpstatus: "+str(httpStatus) log "length: "+str(lenb(content)) End EventHandler
EventHandler Function ProxyAuthenticationRequired(Realm As String, Headers As InternetHeaders, ByRef Name As String, ByRef Password As String) As Boolean log CurrentMethodName End EventHandler
Sub Constructor() // Calling the overridden superclass constructor. // Note that this may need modifications if there are multiple constructor choices. // Possible constructor calls: // Constructor() -- From HTTPSocket // Constructor() -- From TCPSocket // Constructor() -- From SocketCore Super.Constructor log CurrentMethodName qos = new WindowsQOSMBS if qos.Lasterror<>0 then log "Error: "+qos.LasterrorMessage end if End Sub
Sub Destructor() log CurrentMethodName #if TargetWin32 then if qos<>Nil then dim r as boolean = qos.RemoveAllSocketsFromFlow(flowid) if not r then log "Error: "+qos.LasterrorMessage end if qos = nil end if #endif End Sub
Sub Log(s as string) window1.List.AddRow s End Sub
Property FlowId As UInt32
Property qos As WindowsQOSMBS
End Class
End Project

See also:

The items on this page are in the following plugins: MBS Win Plugin.


The biggest plugin in space...