I am baffled in my attempt to create a Windows service (VB.NET) that can listen to a multicast stream. I have created the service, and have also created a console app with the identical Sub. The console works; but the service gets to the Receive method and never moves past it, but has not stopped. (I've put Console.WriteLines before and after to verify that it's waiting at the Receive.)
I know Windows Services don't allow (or discourage, at least) interacting with the desktop. Is there something about a Windows Service that prevents one from listening to a multicast broadcast?
The service is running under a Domain Admin account, as is the console version.
The service is being installed through a setup project in Visual Studio (2008).
There is a constant flow of data -- in the neighborhood of 50-100 records per second.
Here is my Sub -- again, works as a console app, stalls as a service:
Private Shared Sub BeginListen(ByVal evt As EventLog)
Dim bteReceiveData() As Byte
Dim strReceiveData As String
GroupIP = IPAddress.Parse("230.0.0.0")
GrpEP = New IPEndPoint(GroupIP, 12345)
ListenUdp = New UdpClient(12345)
ListenUdp.JoinMulticastGroup(GroupIP)
For i As Integer = 1 To 10
evt.WriteEntry("Inside the Receive loop...initiating Receive...")
bteReceiveData = ListenUdp.Receive(GrpEP)
strReceiveData = Encoding.ASCII.GetString(bteReceiveData, 0, _
bteReceiveData.Length - 1)
Next
ListenUdp.Close()
End Sub
I've been scratching/pounding my head on this for the better part of a month and have tried multiple test projects using different techniques. Inevitably, a console or windowsform app works, but the service version doesn't.
Any help will be HUGELY appreciated!