For Each Ply As clsPlayer in Players
InitializeHUD(Ply.UniqueID)
Next Ply
[SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][SIZE=2] ConnectToOutGauge([/SIZE][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] Port)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#008000] // Make a new instance of the UdpClient[/COLOR][/SIZE]
[SIZE=2] Client = [/SIZE][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]UdpClient[/COLOR][/SIZE][SIZE=2](Port);[/SIZE]
[SIZE=2][COLOR=#008000] // Remote end point to listen on[/COLOR][/SIZE]
[SIZE=2] RemoteIpEndPoint = [/SIZE][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]IPEndPoint[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#2b91af]IPAddress[/COLOR][/SIZE][SIZE=2].Any, Port);[/SIZE]
Client.Connect("127.0.0.01", Port);
[SIZE=2][COLOR=#008000] // Thread to put the receive on[/COLOR][/SIZE]
[SIZE=2] Rcv_Thd = [/SIZE][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]Thread[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]ThreadStart[/COLOR][/SIZE][SIZE=2](RecieveWorker));[/SIZE]
[SIZE=2] Rcv_Thd.Start();[/SIZE]
[SIZE=2] _isConnected = [/SIZE][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff]private [/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][SIZE=2] RecieveWorker()[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff] while[/COLOR][/SIZE][SIZE=2] (!Exit)[/SIZE]
[SIZE=2] {[/SIZE]
[SIZE=2][COLOR=#008000] // Receive data, send it to the buffer[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000] //(This is where it gets stuck on...)[/COLOR][/SIZE]
[SIZE=2] [SIZE=2]Rcv_Buffer = Client.Receive([COLOR="RoyalBlue"]ref[/COLOR] RemoteIpEndPoint);[/SIZE]
[/SIZE]
[SIZE=2][COLOR=#008000] // Make a new instance of the outgauge packet and then[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000] // marshall it to a structure[/COLOR][/SIZE]
[SIZE=2][COLOR=#2b91af]OutGaugePack[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]OutGaugePacket[/COLOR][/SIZE][SIZE=2] OutPack = [/SIZE][SIZE=2][COLOR=#0000ff] new[/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]OutGaugePack[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]OutGaugePacket[/COLOR][/SIZE][SIZE=2]();[/SIZE]
[SIZE=2]OutPack = ([/SIZE][SIZE=2][COLOR=#2b91af]OutGaugePack[/COLOR][/SIZE][SIZE=2].[/SIZE][SIZE=2][COLOR=#2b91af]OutGaugePacket[/COLOR][/SIZE][SIZE=2])[/SIZE][SIZE=2][COLOR=#2b91af]PacketHelper[/COLOR][/SIZE][SIZE=2].DataToPacket(Rcv_Buffer, OutPack);[/SIZE]
[SIZE=2][COLOR=#008000] // Fire the event if needed[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff] if[/COLOR][/SIZE][SIZE=2] (OutGaugeReceived != [/SIZE][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2] OutGaugeReceived(OutPack);[/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]
Bffr = Client.Receive([/SIZE][SIZE=2][COLOR=#0000ff]ref[/COLOR][/SIZE][SIZE=2] RemoteIpEndPoint);
[/SIZE]
[SIZE=2][COLOR=#2b91af]IPEndPoint[/COLOR][/SIZE][SIZE=2] RemoteIpEndPoint = [/SIZE][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][SIZE=2][COLOR=#2b91af]IPEndPoint[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#2b91af]IPAddress[/COLOR][/SIZE][SIZE=2].Any, 21000);
Bffr = Client.Receive([/SIZE][SIZE=2][COLOR=#0000ff]ref[/COLOR][/SIZE][SIZE=2] RemoteIpEndPoint);
[/SIZE]