chronoxor / NetCoreServer

Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
https://chronoxor.github.io/NetCoreServer
MIT License
2.78k stars 579 forks source link

Multicast UDP client sample code : receiving same data multiple time #204

Open vikaschamp opened 2 years ago

vikaschamp commented 2 years ago

Hi ,

I am trying to use netCoreserver library to receive the high frequency NSE TBT multicast data . I have use multicast udp client sample code . But it is receiving same packet multiple time and giving exception stack over flow .

.................................................. Stack overflow. at System.Text.OSEncoding.WideCharToMultiByte(Int32, Char, Int32, Byte, Int32) at System.Text.OSEncoder.GetBytes(Char, Int32, Byte, Int32, Boolean) at System.Text.Encoder.GetBytes(System.ReadOnlySpan1<Char>, System.Span1, Boolean) at System.IO.StreamWriter.Flush(Boolean, Boolean) at System.IO.StreamWriter.WriteLine(System.String) at System.IO.TextWriter+SyncTextWriter.WriteLine(System.String) at System.Console.WriteLine(System.String) at NSEFO_TBT.Controller.MultiCastUDPReader.OnReceived(System.Net.EndPoint, Byte[], Int64, Int64) at NetCoreServer.UdpClient.ProcessReceiveFrom(System.Net.Sockets.SocketAsyncEventArgs) at NetCoreServer.UdpClient.TryReceive() at NSEFO_TBT.Controller.MultiCastUDPReader.OnReceived(System.Net.EndPoint, Byte[], Int64, Int64) at NetCoreServer.UdpClient.ProcessReceiveFrom(System.Net.Sockets.SocketAsyncEventArgs) at NetCoreServer.UdpClient.TryReceive() at NSEFO_TBT.Controller.MultiCastUDPReader.OnReceived(System.Net.EndPoint, Byte[], Int64, Int64) at NetCoreServer.UdpClient.ProcessReceiveFrom(System.Net.Sockets.SocketAsyncEventArgs) at NetCoreServer.UdpClient.TryReceive() ....................

Please suggest what am i doing wrong here .

vikaschamp commented 2 years ago

Stack over flow error is solved it is calling from the OnReceived . It was going in infinte recursion loop so stack over flow error is throwing . But the same data receiving multiple time is still there .