Platforms to show: All Mac Windows Linux Cross-Platform
/Win/Windows QOS/Windows QOS with UDPSocket
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 with UDPSocket
This example is the version from Mon, 5th Jan 2014.
Project "Windows QOS with UDPSocket.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()
sock = new MyUDPSocket
'sock.Address = "192.168.3.255"
sock.Port = 8000
sock.Connect
End EventHandler
Property sock As MyUDPSocket
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 MyUDPSocket Inherits UDPSocket
EventHandler Sub Error()
log CurrentMethodName+": "+str(me.LastErrorCode)
End EventHandler
Sub Connect()
super.Connect
self.Write(self.BroadcastAddress, "Test")
log CurrentMethodName+" "+str(me.Handle)
#if TargetWin32 then
dim r as Boolean
FlowId = 0 // new flow
r = qos.AddSocketToFlow(me.Handle, "192.168.1.1", me.port, 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
else
log "Outgoing Rate set."
end if
#endif
End Sub
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:
- /Win/Windows Displays
- /Win/Windows Hot Key
- /Win/Windows Network Information
- /Win/Windows Process Memory Info
- /Win/Windows Registry Test
- /Win/Windows Serial Ports
- /Win/Windows Shell
- /Win/Windows Shortcuts/Create Shortcuts
- /Win/Windows Shortcuts/Internet Shortcut
- /Win/Windows System Tray with Icon file/Windows System Tray with Icon file
The items on this page are in the following plugins: MBS Win Plugin.