JoinMulticastGroup thrown invalid argument exception in vb.net
I am using following code to which sends udp multicast packets,
Private Const _POLL_COMMAND As String = "PJMReader"
Private Const _PORT As Integer = 8023
Private Const _MULTICAST_ADDRESS As String = "224.0.0.1"
Shared GroupIP As IPAddress
Shared GroupEP As IPEndPoint
Shared ListenUdp As UdpClient
Public Shared Sub Main()
Dim GroupEP As IPEndPoint
Dim SendUdp As New UdpClient()
Dim GroupIP As IPAddress
GroupIP = IPAddress.Parse(_MULTICAST_ADDRESS)
GroupEP = New IPEndPoint(GroupIP, _PORT)
SendUdp.JoinMulticastGroup(GroupIP, 12)
Dim bteSendDate() As Byte
Try
bteSendDate = Encoding.UTF8.GetBytes(_POLL_COMMAND)
SendUdp.Send(bteSendDate, bteSendDate.Length, GroupEP)
Dim tBytes() As Byte = SendUdp.Receive(GroupEP)
MessageBox.Show(Encoding.UTF8.GetString(tBytes))
' System.Console.WriteLine(Encoding.UTF8.GetString(tBytes))
' System.Console.ReadLine()
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Sub
But the Strange thing is that this code is working perfectly on windows
7,2008 server, i am facing this error only on Windows XP Machines
Thanks in Advance
No comments:
Post a Comment