Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
1. We have Web-socket Server application (java [Linux] - TLS12)
2. Java Client application(java client library)
3. Dot net client application (Dot net client library - Net 4.5.2)

We are able to connect to web-socket server app through java client library without any issue, But we are getting the following exception when we trying to connect using dot net client library:
Quote:
Error Details :
"A call to SSPI failed, see inner exception. The message received was unexpected or badly formatted"

Stack trace :
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
at SuperSocket.ClientEngine.SslStreamTcpSession.OnAuthenticated(IAsyncResult result)

What I have tried:

1. System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
2. As it is working from the java client library, there should not be any issue with certificate in server.


Pls help, Thanks in advance.
Posted
Updated 4-Sep-17 20:26pm
v5
Comments
Richard MacCutchan 31-Aug-17 3:30am    
The error message is telling you which part of the request caused the eroro. You just need to inspect it to see why.
raveendranath 31-Aug-17 5:04am    
I just tried to open the connection, did not send any content.

See following code

client = new WebSocket(wsClientImpl.Url, SslProtocols.Tls12.ToString() , null, authorizationHeaderItems, "","", WebSocketVersion.None);
client.Open();
Richard MacCutchan 31-Aug-17 5:24am    
Look at the error message: "The message received was unexpected or badly formatted". So wherever you are sending this message, the receiver is either not expecting it, or what you are sending is in the wrong format.

1 solution

1.Updated WebSocket4Net.dll to
0.15.0-beta6


2.Changed code as following
websocket = new WebSocket4Net.WebSocket(URL,
          sslProtocols: SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls,
          customHeaderItems : authorizationHeaderItems);


It worked for me.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900