New Post: would this work on .NET 3.5 Compact (Win CE 5)?
Created Unassigned: Getting exception which using WebSocket4Net in .net 4.0 [53]
System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state) at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state) at System.Net.Security._SslStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback asyncCallback, Object asyncState) at System.Net.Security.SslStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback asyncCallback, Object asyncState) at WebSocket4Net.SslStreamTcpSession.SendInternal(PosList`1 items)
Please help me in finding root cause of this issue. Is it possible if i can find out the software name which is blocking the connection?
Edited Unassigned: Getting exception which using WebSocket4Net in .net 4.0 [53]
System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state) at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state) at System.Net.Security._SslStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback asyncCallback, Object asyncState) at System.Net.Security.SslStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback asyncCallback, Object asyncState) at WebSocket4Net.SslStreamTcpSession.SendInternal(PosList`1 items)
I have also noticed that when we continuously send requests to web socket...we don't receive any response for 10-20 secs and after that we receives this exception.
Please help me in finding root cause of this issue. Is it possible if i can find out the software name which is blocking the connection?
New Post: Getting exception which using WebSocket4Net in .net 4.0
System.IO.IOException: Unable to write data to the transport connection: An established connection was aborted by the software in your host machine. ---> System.Net.Sockets.SocketException: An established connection was aborted by the software in your host machine
at System.Net.Sockets.Socket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state) at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state) at System.Net.Security._SslStream.StartWriting(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.ProcessWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security._SslStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback asyncCallback, Object asyncState) at System.Net.Security.SslStream.BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback asyncCallback, Object asyncState) at WebSocket4Net.SslStreamTcpSession.SendInternal(PosList`1 items)
I have also noticed that when we continuously send requests to web socket...we don't receive any response for 10-20 secs and after that we receives this exception.
Please help me in finding root cause of this issue. Is it possible if i can find out the software name which is blocking the connection?
Created Unassigned: Allow null/empty origin [54]
New Post: By directional integration with java atmosphere(wasync) from .net Client application
I am able to achieve the communication if the server and client are in both .net environment.
The issue appears when I try to connect to java atmosphere(wasync) with URL:
ws://myHostName:1010/atmosphere_server/atmos/broadcost
then I am getting an exception: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it.
Any help is appreciated. Thanks!
New Post: Send(IList segments) in SuperSocket.SocketBase.AppSession seems not work
SuperSocket.SocketBase.AppSession:
public virtual void Send(IList<ArraySegment<byte>> segments);
In server side, i use WebSocketSession.Send(segments), and the child class WebSocketSession does not override the virtual function. The segments cannot be received in client side.
I only can use WebSocketSession.Send(ArraySegment<byte> segment) to send segment one by one.
New Post: By directional integration with java atmosphere(wasync) from .net Client application
The latest version of WebSocket4Net.dll is 0.14.0.0, tried to include this in the application, but getting compile errors for "Rfc6455Processor" interface. Whether the latest version of WebSocket4Net.dll is not supported for AtmosphereWebSocket ?
Created Unassigned: Add Xamarin.iOS as Xamarin.Mac to NuSpec [55]
Created Unassigned: Implemention of PING/PONG unable to detect connection failures [56]
Suggested fix is to detect when a pong "timeout" has occurred and call a user supplied "pong timeout handler."
Edited Unassigned: Implemention of PING/PONG unable to detect connection failures [56]
Suggested fix is to either:
* detect when a pong "timeout" has occurred and call a user supplied "pong timeout handler."
* send an un-solicited PONG:
```
private void OnPingTimerCallback(object state)
{
if (!string.IsNullOrEmpty(m_LastPingRequest) && !m_LastPingRequest.Equals(LastPongResponse))
{
//have not got last response
try {
protocolProcessor.SendPong(this, "");
} catch (Exception e) {
OnError(e);
}
return;
}
// ...
}
```
New Post: By directional integration with java atmosphere(wasync) from .net Client application
What’s the error? They might use a modified version of WebSocket4Net which is not compatible with the latest version now.
Updated Wiki: Home
WebSocket4Net
a .NET websocket client implementation.
It originated from SuperWebSocket WebSocket Client. For better developing of the websocket client, it was separated from SuperWebSocket and was renamed to WebSocket4Net.
WebSocket4Net will provide websocket client implementation for many different kinds of runtime:
- .Net 2.0
- .Net 3.5
- .Net 4.0
- Mono
- Silverlight
- WindowsPhone
- Xamarin.Android
- Xamarin.iOS
It is compatible with many websocket drafts:
- Hybi-00
- Hybi-10
- RFC6455
NuGet Package: http://www.nuget.org/packages/WebSocket4Net
Xamarin Component Package: https://components.xamarin.com/view/websocket4net
Demo code:
using WebSocket4Net; WebSocket websocket = new WebSocket("ws://localhost:2012/"); websocket.Opened += new EventHandler(websocket_Opened); websocket.Error += new EventHandler<ErrorEventArgs>(websocket_Error); websocket.Closed += new EventHandler(websocket_Closed); websocket.MessageReceived += new EventHandler(websocket_MessageReceived); websocket.Open(); privatevoid websocket_Opened(object sender, EventArgs e) { websocket.Send("Hello World!"); }
Donate:
Bitcoin: 1KwVcdHcH2yNHLJqVJtLfT8uwzKbFNphbb
GitHub Repository: https://github.com/kerryjiang/WebSocket4Net
Recommended .NET WebSocket Server
SuperWebSocket - http://superwebsocket.codeplex.com/
Consult/feature request:
Author's LinkedIn profile: http://cn.linkedin.com/in/kerryjiang
New Post: How to disable ssl certificate validation check
while connecting to Web Socket server my web scoket client gets next error:
System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. ...
Is there a way to disable certificate validation check? I added AllowUnstrustedCertificate = true, because Web Socket Server uses self-signed certificate, but does it solve the validation problem?
New Post: How to disable ssl certificate validation check
You can use the global hook: ServicePointManager.ServerCertificateValidationCallback
New Post: How to disable ssl certificate validation check
I'm using self-signed certificate.
New Post: Send and Receive JSON with Websocket4NET on vb.net
I am new with websocket/json and i have sample code to send and receive data from websocket with vb.net as per below
Public Class Form1
Private websocket As WebSocket4Net.WebSocket
Private Sub Button1_Click(sender As Object, ev As EventArgs) Handles Button1.Click
websocket = New WebSocket4Net.WebSocket("wss://ws.sampleweb.com/websockets/v3")
AddHandler websocket.Opened, Sub(s, e) socketOpened(s, e)
AddHandler websocket.Error, Sub(s, e) socketError(s, e)
AddHandler websocket.Closed, Sub(s, e) socketClosed(s, e)
AddHandler websocket.MessageReceived, Sub(s, e) socketMessage(s, e)
AddHandler websocket.DataReceived, Sub(s, e) socketDataReceived(s, e)
websocket.Open()
End Sub
Sub socketOpened(s As Object, e As EventArgs)
websocket.Send("{""ticks_history"":""R_50"",""end"":""latest"",""count"":10}")
End Sub
Sub socketClosed(s As Object, e As EventArgs)
End Sub
Sub socketError(s As Object, e As SuperSocket.ClientEngine.ErrorEventArgs)
End Sub
Sub socketMessage(s As Object, e As WebSocket4Net.MessageReceivedEventArgs)
MsgBox(e.Message)
End Sub
Sub socketDataReceived(ss As Object, e As WebSocket4Net.DataReceivedEventArgs)
End Sub
End ClassAnd I want to receive the data and store in datagridview, is there anyone can help me with the code, thanks.
Regards,
Dhewa
attached is message received from above code..
Commented Unassigned: AllowUnstrustedCertificate property do not work in 0.14 [51]
```
webSock.AllowUnstrustedCertificate = true;
```
I catch two errors in Error delegate. First
```
"{System.Exception: RemoteCertificateNameMismatch, RemoteCertificateChainErrors}"
```
with no stack trace and then
```
"{SuperSocket.ClientEngine.ErrorEventArgs}
```
with following stack trace:
```
in System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
in SuperSocket.ClientEngine.SslStreamTcpSession.OnAuthenticated(IAsyncResult result)"
```
Comments: I can confirm this doesn't work in v0.11 either. Having set the property it throws this error with some certificates System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result) at SuperSocket.ClientEngine.SslStreamTcpSession.OnAuthenticated(IAsyncResult result)
New Post: JsonWebSocket failure under stress test
I started look at WebSocket4Net, an interesting project, I appreciate the effort you've spent on it. I noticed one problem though.
In the file "WebSocket4Net\JsonWebSocket.cs", the "token" is not unique enough and that causes a failure under stress test.
For instance, if I do a stress test like:
var clientJsonWebSocket = new JsonWebSocket("ws://somewhere");
for (var i = 0; i < 10000§; ++i)
{
clientJsonWebSocket.Query<string>("Name", "content", s => { });
}
...adding to the dictionary in RegisterExecutor below will fail with "An item with the same key has already been added." void RegisterExecutor<T>(string name, string token, IJsonExecutor executor)
{
lock (m_ExecutorDict)
{
if (string.IsNullOrEmpty(token))
m_ExecutorDict.Add(name, executor);
else
m_ExecutorDict.Add(string.Format(m_QueryKeyTokenTemplate, name, token), executor); // <<<<<<<<< Gives ArgumentException under stress test
}
}
I did a quick fix with using a Guid instead (see below), seems to solve my problem, but I don't know if there may be other side effects: string Query<T>(string name, object content, IJsonExecutor executor)
{
if (string.IsNullOrEmpty(name))
throw new ArgumentNullException("name");
//var token = m_Random.Next(1000, 9999).ToString();
var token = Guid.NewGuid().ToString();
RegisterExecutor<T>(name, token, executor);
Any chance you can look into this and do a fix?(I had a simple server responding to the request when I tested, let me know if you need more info to reproduce)
Thanks in advance,
Mattias
New Post: Proxy support
I would like to know if the WebSocket4Net / SuperSocket.ClientEngine supports already a NTLM proxy?
Could you please confirm that for me?
Thanks,
Cleiton