I made a xamarin iOS/Android Application.
This App use websockets-sharp
for the comunication with the server.
Now after connecting i got the following error:
03-29 16:11:14.999 I/mono-stdout(19865): 29.03.2018 16:11:14|Fatal|<>c__DisplayClass17.<startReceiving>b__16|WebSocketSharp.WebSocketException: The header of a frame cannot be read from the stream.
29.03.2018 16:11:14|Fatal|<>c__DisplayClass17.<startReceiving>b__16|WebSocketSharp.WebSocketException: The header of a frame cannot be read from the stream.
03-29 16:11:15.005 I/mono-stdout(19865): at WebSocketSharp.WebSocketFrame.processHeader (System.Byte[] header) [0x00017] in <38d3cef14c5a4fc9a92de0991034bc1a>:0
at WebSocketSharp.WebSocketFrame.processHeader (System.Byte[] header) [0x00017] in <38d3cef14c5a4fc9a92de0991034bc1a>:0
at WebSocketSharp.WebSocketFrame+<>c__DisplayClassa.<readHeaderAsync>b__9 (System.Byte[] bytes) [0x00000] in <38d3cef14c5a4fc9a92de0991034bc1a>:0
at WebSocketSharp.Ext+<>c__DisplayClass9.<ReadBytesAsync>b__8 (System.IAsyncResult ar) [0x000a2] in <38d3cef14c5a4fc9a92de0991034bc1a>:0
03-29 16:11:15.005 I/mono-stdout(19865): at WebSocketSharp.WebSocketFrame+<>c__DisplayClassa.<readHeaderAsync>b__9 (System.Byte[] bytes) [0x00000] in <38d3cef14c5a4fc9a92de0991034bc1a>:0
03-29 16:11:15.006 I/mono-stdout(19865): at WebSocketSharp.Ext+<>c__DisplayClass9.<ReadBytesAsync>b__8 (System.IAsyncResult ar) [0x000a2] in <38d3cef14c5a4fc9a92de0991034bc1a>:0
[0:] Socket is disconected...
Does someone else got this error too and know how to solve this?
Its not the code that is causing error its the mess created by algorithm you have written for the application. The actual error is "The header of a frame cannot be read from the stream" this simply can be caused due to the following issues
Your appliation and server both are sending bulk messages or heavy data at faster rate at the same time to each other. which is well defined and explained here
Solution
You have to optimize your algorithm to meet the following constraints and remove that error
Sorry, the problem was in my code...
If you send an event that doesn't exist on the server, this error occures. You can only send events that exists, otherwise it will fail.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With