• 1
Votes
name
name Punditsdkoslkdosdkoskdo

WebSockets Sharp Exeption WebSocket Exception

I made a xamarin iOS/Android Application. This App talks to the server over websockets-sharp.

Now after connecting i got this 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?

Thx

 

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

  1. Monitor and Control the data transfer rate to/from the server
  2. Try to wait for the completion of data transfer of one side (Half Duplex)
  • 0
Reply Report