Quantcast
Channel: WebSocket4Net
Viewing all 109 articles
Browse latest View live

New Post: would this work on .NET 3.5 Compact (Win CE 5)?

$
0
0
Can this work with .NET 3.5 Compact?

Created Unassigned: Getting exception which using WebSocket4Net in .net 4.0 [53]

$
0
0
I am getting below mentioned exception randomly on few machines while using WebSocket4Net 0.9.0.0 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)

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]

$
0
0
I am getting below mentioned exception randomly on few machines while using WebSocket4Net 0.9.0.0 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?


New Post: Getting exception which using WebSocket4Net in .net 4.0

$
0
0
I am getting below mentioned exception randomly on few machines while using WebSocket4Net 0.9.0.0 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]

$
0
0
My end point server validates origin of the websocket, so that it allows only empty origin for the websockets. I'm using WebSocket4Net and bumped into a problem that it's not possible to set empty origin, as it will be taken from Uri in this case. (I believe it comes from here - https://github.com/kerryjiang/WebSocket4Net/blob/master/WebSocket4Net/WebSocket.cs#L134 ). What for is this limitation?

New Post: By directional integration with java atmosphere(wasync) from .net Client application

$
0
0
We have a atmosphere(wasync) server Application which is written in java and I want to communicate with .net thick client application using websocket4Net.

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

$
0
0
This below function 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

$
0
0
After using WebSocket4Net.dll version 0.9.0.0 along with AtmosphereWebSocket4Net.dll now I am able to connect to java atmosphere(wasync) from .net Client application also I am able to receive the message from java application. But the message which I have sent is not getting received in java 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]

$
0
0
So far from messing around with it, the Xamarin.iOS (unified) version already supports Xamarin.Mac. You don't need to build anything new, just copy the same nuspec line for Xamarin.iOS10 but use "lib\Xamarin.Mac20" instead. Thanks for all the hard work

Created Unassigned: Implemention of PING/PONG unable to detect connection failures [56]

$
0
0
The OnPingTimerCallback refuses to send another PING until it first receives a pending PONG, thus rendering the websocket unable to detect connection failures.

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]

$
0
0
The OnPingTimerCallback refuses to send another PING until it first receives a pending PONG, thus rendering the websocket unable to detect connection failures.

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

$
0
0

What’s the error? They might use a modified version of WebSocket4Net which is not compatible with the latest version now.

Updated Wiki: Home

$
0
0

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 Packagehttp://www.nuget.org/packages/WebSocket4Net

Xamarin Component Packagehttps://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:

 kerry-jiang@hotmail.com

Author's LinkedIn profile: http://cn.linkedin.com/in/kerryjiang

 

 

New Post: How to disable ssl certificate validation check

$
0
0
Hi to all,

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

$
0
0

You can use the global hook: ServicePointManager.ServerCertificateValidationCallback


New Post: How to disable ssl certificate validation check

$
0
0
Kerryjiang, I read topics more and found out that there is a rule: "if your websocket server can be access as "ws://gameserver/", then your certificate's CN should be "gameserver". Actually my error was exactly about that: wss server was: test.domain.com and I used sertificate "test". I got validation error in this case. Then i did certificate: test.domain.com and all work correct. So I can't avoid this rule, right? and certificate name must always match wss server name?
I'm using self-signed certificate.

New Post: Send and Receive JSON with Websocket4NET on vb.net

$
0
0
Hi there,

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 Class

And 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..
Image

Commented Unassigned: AllowUnstrustedCertificate property do not work in 0.14 [51]

$
0
0
After upgdaring to version 0.14 I can't connect to wss:// self signed service. Despite on
```
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

$
0
0
Hi,

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

$
0
0
Hello kerryjiang,

I would like to know if the WebSocket4Net / SuperSocket.ClientEngine supports already a NTLM proxy?
Could you please confirm that for me?

Thanks,
Cleiton
Viewing all 109 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>