Hey: I have tried and tried to make the following code work to receive UDP transmissions and it will not work. Can anyone spot what the trouble might be? Much appreciated.

Main Code:

Imports System.Net.Sockets
Imports System.Net
Public Class Form1
Inherits System.Windows.Forms.Form

Private WithEvents wsUdp As New Udp()

Private Sub wsUdp_onDataArrival(ByVal Data() As Byte, ByVal
TotalBytes As Integer) Handles wsUdp.onDataArrival

Dim inUDPData As String = wsUdp.BytestoString(Data)
MsgBox("Heres the data " & inUDPData)

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class


'UDP STUFF

Imports System.Net.Sockets
Imports System.Net
Imports System.Text

Public Class Udp
Public Event onDataArrival(ByVal Data As Byte(), ByVal TotalBytes As Integer)

Public Function StringToBytes(ByVal Data As String) As Byte()
StringToBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(Data)
End Function

Public Function BytestoString(ByVal Data As Byte()) As String
BytestoString = System.Text.ASCIIEncoding.ASCII.GetString(Data)
End Function


Sub DataArrival()
Dim bytesread As Integer
Dim wsck As New UdpClient()
Dim done As Boolean = False
Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)

Try
Console.WriteLine("Waiting for broadcast")
Dim socketdata As Byte() = wsck.Receive(RemoteIpEndPoint)
bytesread = socketdata.Length
RaiseEvent onDataArrival(socketdata, bytesread)

Console.WriteLine("Received broadcast from {0} :" + _
ControlChars.Cr + " {1}" + ControlChars.Cr, _
RemoteIpEndPoint.ToString, _
Encoding.ASCII.GetString(socketdata, 0, socketdata.Length))

Catch e As Exception
Console.WriteLine(e.ToString())
End Try


End Sub

End Class