Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'fancy fancy progress bar that shows biggest contributors by color
- Imports System.Net.Sockets
- Imports System.Security.AccessControl
- Imports System.Security.Principal
- Public Class Form1
- Dim Jobname As String = ""
- Dim Source As String = ""
- Dim Frames As New List(Of String)
- Dim frameworking As New List(Of Boolean)
- Dim Framedone As New List(Of Boolean)
- Dim Frameby As New List(Of String)
- Dim framestart As New List(Of TimeSpan)
- Dim frameend As New List(Of TimeSpan)
- Dim frameduration As New List(Of TimeSpan)
- Dim Clients As New List(Of String)
- Dim ClientPubPorts As New List(Of Integer)
- Dim ClientSubPorts As New List(Of Integer)
- Dim ClientFrame As New List(Of Integer)
- Dim Clienttotal As New List(Of Integer)
- Dim clientconnected As New List(Of Boolean)
- Dim clientbusy As New List(Of Boolean)
- Dim clientdescription As New List(Of String)
- Dim Widthz As Integer = 320
- Dim Heightz As Integer = 240
- Dim Started As Boolean
- Dim networkshare As String = ""
- Dim jobfilename As String
- Dim filesearch As Boolean = False
- Dim finished As Boolean = False
- Dim publishers As New List(Of UdpClient)
- Dim subscribers As New List(Of UdpClient)
- Dim mycomputername As String = Environment.MachineName
- Dim startport As Integer = 10100
- Dim mycomputerconnections() As Net.NetworkInformation.NetworkInterface
- Dim MCPub As New UdpClient()
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- mycomputerconnections = Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
- TBServer.Text = mycomputername
- MCPub.JoinMulticastGroup(Net.IPAddress.Parse("239.80.8.5"), 4)
- MCPub.EnableBroadcast = True
- MCPub.Client.Blocking = False
- MCPub.Client.ReceiveTimeout = 100
- MCPub.ExclusiveAddressUse = False
- MCPub.Client.MulticastLoopback = True
- For i = 0 To mycomputerconnections.Length - 1
- CBConnections.Items.Add(mycomputerconnections(i).Name)
- Next
- CBConnections.SelectedIndex = My.Settings.Connection
- End Sub
- 'Initial Setup
- Private Sub PBSource_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PBSource.Click
- OFDSource.ShowDialog()
- End Sub
- Private Sub OFDSource_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OFDSource.FileOk
- Source = OFDSource.FileName.Substring(0, OFDSource.FileName.LastIndexOf("\"))
- jobfilename = OFDSource.FileName.Substring(OFDSource.FileName.LastIndexOf("\") + 1)
- TBSource.Text = Source
- filesearch = False
- finished = False
- If RadioButton1.Checked = True Then
- If IO.Directory.Exists("C:\POVShare") = False Then
- IO.Directory.CreateDirectory("C:\POVShare")
- Dim managementClass As New ManagementClass("Win32_Share")
- Dim inParams As ManagementBaseObject = managementClass.GetMethodParameters("Create")
- inParams.Item("Description") = "POVShare"
- inParams.Item("Name") = "POVShare"
- inParams.Item("Path") = "C:\POVShare"
- inParams.Item("Type") = 0
- inParams.Item("Password") = Nothing
- inParams.Item("Access") = Nothing
- inParams.Item("MaximumAllowed") = Nothing
- If (DirectCast(managementClass.InvokeMethod("Create", inParams, Nothing).Properties.Item("ReturnValue").Value, UInt32) <> 0) Then
- Throw New Exception("Unable to share directory.")
- End If
- Dim FilePath As String = "C:\POVShare"
- Dim dirinfo As New IO.DirectoryInfo(FilePath)
- Dim dirsec As DirectorySecurity = dirinfo.GetAccessControl()
- dirsec.AddAccessRule(New FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow))
- dirsec.AddAccessRule(New FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.InheritOnly, AccessControlType.Allow))
- dirsec.AddAccessRule(New FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.None, PropagationFlags.InheritOnly, AccessControlType.Allow))
- dirinfo.SetAccessControl(dirsec)
- 'SID
- Dim NTacc As New NTAccount("Everyone")
- Dim userSID As SecurityIdentifier = DirectCast(NTacc.Translate(GetType(SecurityIdentifier)), SecurityIdentifier)
- Dim utenteSIDArray(userSID.BinaryLength) As Byte
- 'TRUSTEE
- Dim usertrustee As ManagementObject = New ManagementClass(New ManagementPath("Win32_Trustee"), Nothing)
- usertrustee.Item("Name") = "Everyone"
- usertrustee.Item("SID") = utenteSIDArray
- 'ACE
- Dim userACE As ManagementObject = New ManagementClass(New ManagementPath("Win32_Ace"), Nothing)
- userACE.Item("AccessMask") = 2032127 'Full access
- userACE.Item("AceFlags") = AceFlags.ObjectInherit & AceFlags.ContainerInherit
- userACE.Item("AceType") = AceType.AccessAllowed
- userACE.Item("Trustee") = usertrustee
- Dim userSecurityDescriptor As ManagementObject = New ManagementClass(New ManagementPath("Win32_SecurityDescriptor"), Nothing)
- userSecurityDescriptor("ControlFlags") = 4
- userSecurityDescriptor("DACL") = New Object() {userACE}
- 'Permission
- Dim mc As ManagementClass = New ManagementClass("Win32_Share")
- Dim share As ManagementObject = New ManagementObject(mc.Path.ToString & ".Name='" & "POVShare" & "'")
- share.InvokeMethod("SetShareInfo", New Object() {Int32.MaxValue, "POVShare", userSecurityDescriptor})
- End If
- If IO.Directory.Exists("C:\POVShare\" & Jobname) = False Then
- My.Computer.FileSystem.CopyDirectory(Source, "C:\POVShare\" & Jobname, FileIO.UIOption.AllDialogs)
- Dim FilePath As String = "C:\POVShare\" & Jobname
- Dim dirinfo As New IO.DirectoryInfo(FilePath)
- Dim dirsec As DirectorySecurity = dirinfo.GetAccessControl()
- dirsec.AddAccessRule(New FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow))
- dirsec.AddAccessRule(New FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.InheritOnly, AccessControlType.Allow))
- dirsec.AddAccessRule(New FileSystemAccessRule("Everyone", FileSystemRights.FullControl, InheritanceFlags.None, PropagationFlags.InheritOnly, AccessControlType.Allow))
- dirinfo.SetAccessControl(dirsec)
- End If
- '
- Source = "C:\POVShare\" & Jobname
- Else
- networkshare = FBDShare.SelectedPath
- If IO.Directory.Exists(networkshare & "\" & Jobname) = False Then
- My.Computer.FileSystem.CopyDirectory(Source, networkshare & "\" & Jobname, FileIO.UIOption.AllDialogs)
- Dim filepath As String = networkshare & "\" & Jobname
- End If
- End If
- Timer1.Enabled = True
- FrameRead()
- End Sub
- 'Frame Length
- Private Sub FrameRead()
- Dim filelist() As String = IO.Directory.GetFiles(Source)
- Dim ini As String = "naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame"
- For i = 0 To filelist.Count - 1
- Dim fName As String = filelist(i).Substring(Source.Length + 1)
- If fName.Contains("ini") And fName.Count < ini.Count Then
- ini = fName
- End If
- Next
- If ini = "naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame" Then
- MsgBox("Unable to find job INI")
- Source = ""
- Return
- End If
- ini = IO.Path.Combine(Source, ini)
- Dim filelines() As String
- GC.Collect()
- filelines = IO.File.ReadAllLines(ini)
- GC.Collect()
- Dim framecount As Integer = 0
- For i = 0 To filelines.Count - 1
- If filelines(i).Contains("Final_Frame") Then
- framecount = filelines(i).Substring(12)
- End If
- Next
- For i = 0 To framecount - 1
- DGVFrames.Rows.Add()
- DGVFrames.Rows(DGVFrames.Rows.Count - 1).Cells(0).Value = i + 1
- Frames.Add("")
- Framedone.Add(False)
- frameworking.Add(False)
- Frameby.Add("")
- framestart.Add(New TimeSpan)
- frameend.Add(New TimeSpan)
- frameduration.Add(New TimeSpan)
- Next
- End Sub
- 'Main Loop
- Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
- 'MCPub-------------------------------------------------------
- Dim ep2 As Net.IPEndPoint = New Net.IPEndPoint(Net.IPAddress.Parse("239.80.8.5"), 10100)
- Try
- Dim rcvbytes() As Byte = MCPub.Receive(ep2)
- Dim MCSubRcv As String = System.Text.Encoding.ASCII.GetString(rcvbytes)
- If MCSubRcv.Contains("%PVD%MCP") Then
- Dim MCsubRcvLines() As String = MCSubRcv.Split("%")
- Connect(MCsubRcvLines(3), MCsubRcvLines(4))
- End If
- Catch ex As Exception
- End Try
- Dim lastportused As Integer = startport
- For i = 0 To ClientPubPorts.Count - 1
- If ClientPubPorts(i) >= lastportused Then
- lastportused = ClientPubPorts(i)
- End If
- Next
- For i = 0 To ClientSubPorts.Count - 1
- If ClientSubPorts(i) >= lastportused Then
- lastportused = ClientSubPorts(i)
- End If
- Next
- Try
- Dim stringz As String = "%PVD%MCS%" & mycomputername & "%" & lastportused + 1 & "%" & lastportused + 2
- Dim sendbytes() As Byte = System.Text.Encoding.ASCII.GetBytes(stringz)
- MCPub.Send(sendbytes, sendbytes.Length, ep2)
- Catch ex As Exception
- End Try
- 'Complete?---------------------------------------------------
- Dim complete As Boolean = True
- Dim framesdone As Integer = 0
- If Source <> "" And Frames.Count > 0 Then
- For i = 0 To Framedone.Count - 1
- If Framedone(i) = False Then
- complete = False
- Else
- framesdone = framesdone + 1
- End If
- Next
- If complete = True Then
- Timer1.Enabled = False
- finished = True
- MsgBox("POV Ray Complete")
- End If
- End If
- 'Draw Progress-----------------------------------------------
- If Frames.Count > 0 Then
- Dim ratio As Integer = (framesdone / Frames.Count) * PictureBox1.Size.Width
- Dim graphpic As New Bitmap(PictureBox1.Width, PictureBox1.Height)
- Dim graphgfx As Graphics = Graphics.FromImage(graphpic)
- graphgfx.FillRectangle(Brushes.Black, New Rectangle(0, 0, graphpic.Width, graphpic.Height))
- graphgfx.FillRectangle(Brushes.LimeGreen, New Rectangle(0, 0, ratio, graphpic.Height))
- PictureBox1.Image = graphpic
- End If
- '--------------------------------
- For i = 0 To Clients.Count - 1
- Dim stringz As String = ""
- Dim Received As String = ""
- 'Send Section----------------------------------------------
- If clientconnected(i) = False Then
- stringz = "%PVD%N" & mycomputername
- Else
- If ClientFrame(i) = 0 And Source <> "" And Started = True And filesearch = True And finished = False Then
- Dim frametogive As Integer = 1
- For i2 = 0 To Frames.Count - 1
- If frameworking(i2) = False And Framedone(i2) = False Then
- frameworking(i2) = True
- ClientFrame(i) = i2 + 1
- frametogive = i2 + 1
- Exit For
- End If
- Next
- Widthz = NumericUpDown2.Value
- Heightz = NumericUpDown3.Value
- If RadioButton1.Checked = True Then
- networkshare = ""
- End If
- stringz = "%PVD%J" & Jobname & "%S" & networkshare & "%W" & Widthz & "%H" & Heightz & "%F" & frametogive
- End If
- End If
- 'UDPs--------------------------------------------------------
- If stringz <> "" Then
- Try
- Dim sendbytes() As Byte = System.Text.Encoding.ASCII.GetBytes(stringz)
- publishers(i).Send(sendbytes, sendbytes.Length)
- Catch ex As Exception
- End Try
- End If
- Try
- Dim ep As System.Net.IPEndPoint = New System.Net.IPEndPoint(System.Net.IPAddress.Any, ClientSubPorts(i))
- Dim rcvbytes() As Byte = subscribers(i).Receive(ep)
- Received = System.Text.Encoding.ASCII.GetString(rcvbytes)
- Catch ex As Exception
- End Try
- 'Receive Section------------------------------------------------
- If Received <> "" Then
- 'Connect ACK
- If Received = "%PVD%C" Then
- clientconnected(i) = True
- End If
- 'Frame Done
- If Received.Contains("%PVD%F") Then
- Dim reclines() As String = Received.Split("%")
- Dim framecomplete As Integer = reclines(2).Substring(1)
- ClientFrame(i) = 0
- Frames(framecomplete - 1) = reclines(3).Substring(1)
- Framedone(framecomplete - 1) = True
- frameend(framecomplete - 1) = My.Computer.Clock.LocalTime.TimeOfDay
- DGVFrames.Rows(framecomplete - 1).Cells(4).Value = frameend(framecomplete - 1).Hours.ToString & ":" & frameend(framecomplete - 1).Minutes.ToString & ":" & frameend(framecomplete - 1).Seconds.ToString
- frameworking(framecomplete - 1) = False
- DGVFrames.Rows(framecomplete - 1).Cells(1).Value = "Rendered"
- Frameby(framecomplete - 1) = Clients(i)
- DGVFrames.Rows(framecomplete - 1).Cells(2).Value = Clients(i)
- Clienttotal(i) = Clienttotal(i) + 1
- End If
- 'Frame Start ACK
- If Received.Contains("%PVD%J") Then
- Dim frametogive As Integer = Received.Substring(6)
- clientbusy(i) = True
- ClientFrame(i) = frametogive
- frameworking(frametogive - 1) = True
- framestart(frametogive - 1) = My.Computer.Clock.LocalTime.TimeOfDay
- DGVFrames.Rows(frametogive - 1).Cells(3).Value = framestart(frametogive - 1).Hours.ToString & ":" & framestart(frametogive - 1).Minutes.ToString & ":" & framestart(frametogive - 1).Seconds.ToString
- DGVFrames.Rows(frametogive - 1).Cells(1).Value = "Working"
- End If
- End If
- Next
- 'Frame Finder----------------------------------------------------
- If filesearch = False Then
- Dim path As String = ""
- If RadioButton1.Checked = True Then
- path = "C:\POVShare\" & Jobname
- Else
- path = networkshare
- End If
- For i = 0 To Frames.Count - 1
- Dim maxstring As Integer = (Frames.Count).ToString.Length
- Dim filepath As String = path & "Images\" & jobfilename.Substring(0, jobfilename.Length - 4) & (i + 1).ToString().PadLeft(maxstring, "0") & ".png"
- If IO.File.Exists(filepath) Then
- Framedone(i) = True
- DGVFrames.Rows(i).Cells(1).Value = "Found"
- End If
- Next
- filesearch = True
- End If
- 'DGV Update------------------------------------------------------
- Dim maxworkingframe As Integer = 0
- For i = 0 To Frames.Count - 1
- If frameworking(i) = True Then
- Dim tempspan As TimeSpan = My.Computer.Clock.LocalTime.TimeOfDay - framestart(i)
- DGVFrames.Rows(i).Cells(5).Value = tempspan.Minutes.ToString & ":" & tempspan.Seconds.ToString
- If i > maxworkingframe Then
- maxworkingframe = i
- End If
- End If
- Next
- If DGVFrames.Focused = False And maxworkingframe > 7 Then
- DGVFrames.FirstDisplayedScrollingRowIndex = maxworkingframe - 7
- End If
- For i = 0 To Clients.Count - 1
- If ClientFrame(i) = 0 Then
- DGVClients.Rows(i).Cells(4).Value = ""
- Else
- DGVClients.Rows(i).Cells(4).Value = ClientFrame(i)
- End If
- DGVClients.Rows(i).Cells(5).Value = Clienttotal(i)
- Next
- End Sub
- 'Add Client
- Private Sub PBAddClient_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PBAddClient.Click
- If TBClient.Text Is Nothing Or TBClient.Text = "" Then
- MsgBox("No Client Specified")
- Return
- End If
- Connect(TBClient.Text, "")
- End Sub
- Private Sub Connect(ByVal clientnamez As String, ByVal description As String)
- Dim pinger As New Net.NetworkInformation.Ping 'Does it ping?
- Try
- Dim pingreply As Net.NetworkInformation.PingReply = pinger.Send(clientnamez, 1000)
- If pingreply.Status <> Net.NetworkInformation.IPStatus.Success Then
- MsgBox("Unable to Ping, verify your IP and PLC addresses are correct", MsgBoxStyle.Exclamation)
- Return
- End If
- Catch ex As Exception
- MsgBox("Ping Error on, verify your IP and PLC addresses are correct", MsgBoxStyle.Exclamation) 'Ping fail so hard that you gotta have further info??
- Return
- End Try
- Clients.Add(clientnamez)
- Dim lastportused As Integer = startport
- For i = 0 To ClientPubPorts.Count - 1
- If ClientPubPorts(i) >= lastportused Then
- lastportused = ClientPubPorts(i)
- End If
- Next
- For i = 0 To ClientSubPorts.Count - 1
- If ClientSubPorts(i) >= lastportused Then
- lastportused = ClientSubPorts(i)
- End If
- Next
- ClientPubPorts.Add(lastportused + 1)
- ClientSubPorts.Add(lastportused + 2)
- publishers.Add(New UdpClient())
- publishers(publishers.Count - 1).Client.Blocking = False
- publishers(publishers.Count - 1).ExclusiveAddressUse = False
- publishers(publishers.Count - 1).Connect(Clients(Clients.Count - 1), ClientPubPorts(ClientPubPorts.Count - 1))
- subscribers.Add(New UdpClient())
- subscribers(subscribers.Count - 1).Client.Blocking = False
- subscribers(subscribers.Count - 1).Client.ReceiveTimeout = 100
- subscribers(subscribers.Count - 1).ExclusiveAddressUse = False
- subscribers(subscribers.Count - 1).Client.Bind(New Net.IPEndPoint(Net.IPAddress.Any, ClientSubPorts(ClientSubPorts.Count - 1)))
- clientconnected.Add(False)
- ClientFrame.Add(0)
- Clienttotal.Add(0)
- clientbusy.Add(False)
- clientdescription.Add(description)
- DGVClients.Rows.Add()
- DGVClients.Rows(DGVClients.Rows.Count - 1).Cells(0).Value = Clients(Clients.Count - 1)
- DGVClients.Rows(DGVClients.Rows.Count - 1).Cells(1).Value = clientdescription(Clients.Count - 1)
- DGVClients.Rows(DGVClients.Rows.Count - 1).Cells(2).Value = ClientPubPorts(ClientPubPorts.Count - 1)
- DGVClients.Rows(DGVClients.Rows.Count - 1).Cells(3).Value = ClientSubPorts(ClientSubPorts.Count - 1)
- End Sub
- 'Delete Client
- Private Sub PBDeleteClient_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PBDeleteClient.Click
- Dim selectedrow As Integer = DGVClients.SelectedCells.Item(0).RowIndex
- If Started = True Then
- MsgBox("Rendering must be stopped first.")
- Return
- End If
- If frameworking(ClientFrame(selectedrow) - 1) = True And clientbusy(selectedrow) = True Then
- frameworking(ClientFrame(selectedrow) - 1) = False
- DGVFrames.Rows(ClientFrame(selectedrow) - 1).Cells(1).Value = ""
- DGVFrames.Rows(ClientFrame(selectedrow) - 1).Cells(3).Value = ""
- DGVFrames.Rows(ClientFrame(selectedrow) - 1).Cells(5).Value = ""
- End If
- ClientPubPorts.RemoveAt(ClientPubPorts.IndexOf(DGVClients.Rows(selectedrow).Cells(2).Value))
- ClientSubPorts.RemoveAt(ClientSubPorts.IndexOf(DGVClients.Rows(selectedrow).Cells(3).Value))
- publishers(selectedrow).Client.Dispose()
- publishers.RemoveAt(selectedrow)
- subscribers(selectedrow).Client.Dispose()
- subscribers.RemoveAt(selectedrow)
- Clients.RemoveAt(selectedrow)
- clientconnected.RemoveAt(selectedrow)
- ClientFrame.RemoveAt(selectedrow)
- Clienttotal.RemoveAt(selectedrow)
- clientbusy.RemoveAt(selectedrow)
- DGVClients.Rows.RemoveAt(selectedrow)
- End Sub
- 'Job Name
- Private Sub TBJobName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TBJobName.TextChanged
- If TBJobName.Text IsNot Nothing And TBJobName.Text <> "" And (RadioButton1.Checked = True Or RadioButton2.Checked = True) Then
- PBSource.Enabled = True
- Jobname = TBJobName.Text
- Else
- PBSource.Enabled = False
- End If
- End Sub
- 'Start / Stop
- Private Sub PBStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PBStart.Click
- If Started = False Then
- Started = True
- PBStart.Text = "Stop"
- Else
- Started = False
- PBStart.Text = "Start"
- End If
- End Sub
- 'Network path choose
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- FBDShare.ShowDialog()
- End Sub
- Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
- If RadioButton2.Checked = True Then
- FBDShare.ShowDialog()
- If TBJobName.Text IsNot Nothing And TBJobName.Text <> "" And (RadioButton1.Checked = True Or RadioButton2.Checked = True) Then
- PBSource.Enabled = True
- Jobname = TBJobName.Text
- End If
- End If
- End Sub
- Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
- If TBJobName.Text IsNot Nothing And TBJobName.Text <> "" And (RadioButton1.Checked = True Or RadioButton2.Checked = True) Then
- PBSource.Enabled = True
- Jobname = TBJobName.Text
- End If
- End Sub
- 'Connection Set
- Private Sub CBConnections_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CBConnections.SelectedIndexChanged
- For i = 0 To mycomputerconnections(CBConnections.SelectedIndex).GetIPProperties.UnicastAddresses.Count - 1
- If mycomputerconnections(CBConnections.SelectedIndex).GetIPProperties.UnicastAddresses(i).Address.AddressFamily = Net.Sockets.AddressFamily.InterNetwork Then
- Dim bytez() As Byte = mycomputerconnections(CBConnections.SelectedIndex).GetIPProperties.UnicastAddresses(i).Address.GetAddressBytes
- Dim AddressString As String = bytez(0) & "." & bytez(1) & "." & bytez(2) & "." & bytez(3)
- Dim ipep As New Net.IPEndPoint(Net.IPAddress.Parse(AddressString), 10100)
- Try
- MCPub.Close()
- MCPub = New Net.Sockets.UdpClient(Net.Sockets.AddressFamily.InterNetwork)
- MCPub.Client.Blocking = False
- MCPub.Client.ReceiveTimeout = 100
- MCPub.ExclusiveAddressUse = False
- MCPub.Client.MulticastLoopback = True
- MCPub.EnableBroadcast = True
- MCPub.Client.Bind(ipep)
- MCPub.JoinMulticastGroup(Net.IPAddress.Parse("239.80.8.5"), 4)
- LBConnectStatus.ForeColor = Color.LimeGreen
- LBConnectStatus.Text = "√"
- My.Settings.Connection = CBConnections.SelectedIndex
- My.Settings.Save()
- Catch ex As Exception
- LBConnectStatus.ForeColor = Color.Red
- LBConnectStatus.Text = "X"
- End Try
- End If
- Next
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement