Hi, Im trying to develop a udp client server application.
Ive used code ive seen from other examples on the net, im just having a few problems with the server application at the moment.
VB.NET:
PublicClass UDPSrv
Dim receivingUdpClient As UdpClient
Public RemoteIpEndPoint AsNew System.Net.IPEndPoint("127.0.0.1", 8000)
SharedSub Main()
Try
Dim receivingUdpClient As UdpClient
Dim RemoteIpEndPoint
** Dim receiveBytes As [Byte]() = receivingUdpClient.Receive(RemoteIpEndPoint)
Dim clientdata
Dim BitDet As BitArray
BitDet = New BitArray(receiveBytes)Const portNumber AsInteger = 8000
Console.WriteLine("Waiting for connection...")
receivingUdpClient = New System.Net.Sockets.UdpClient(portNumber)
Console.WriteLine("Connection accepted.")
Console.WriteLine(("Client sent: " + clientdata))
'Dim responseString As String = "Connected to server."
clientdata = clientdata + 1
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(clientdata)
Console.WriteLine(("Message Sent /> : " + clientdata))
Console.WriteLine("exit")
Console.ReadLine()
Catch ex As Exception
Console.WriteLine(ex.ToString())
Console.ReadLine()
EndTry
EndSub
EndClass
The line Im having a problem is marked with **
I get a null reference exception, jsut wondering if anyone can clear this up for me, as im new to using vb.net and creating udp applicaitons so any help would just be great.
Thanks