SuperWebSocket and Mono 2.11

Apr 28, 2012 at 2:31 PM

Hi

 

I updated mono to 2.11 and now I can't get SuperWebSocket to work in async mode.

Is this problem known?

 

Thank you

abel

Apr 28, 2012 at 3:29 PM
Did you find something in logs?

Sent from my Windows Phone

From: abel_silva
Sent: 4/28/2012 9:31 PM
To: kerry-jiang@hotmail.com
Subject: SuperWebSocket and Mono 2.11 [SuperWebSocket:353892]

From: abel_silva

Hi

I updated mono to 2.11 and now I can't get SuperWebSocket to work in async mode.

Is this problem known?

Thank you

abel

Apr 28, 2012 at 5:58 PM

With mode="Async" I only get status information

[......................]
CPU Usage: 0.00%, Physical Memory Usage: 0.00, Total Thread Count: 0
AvailableWorkingThreads: 181, AvailableCompletionPortThreads: 8
MaxWorkingThreads: 200, MaxCompletionPortThreads: 8
SuperWebSocket - Total Connections: 0, Total Handled Commands: 0, Command Handling Speed: 0/s


---------------------------------------------------
CPU Usage: 0.00%, Physical Memory Usage: 0.00, Total Thread Count: 0
AvailableWorkingThreads: 183, AvailableCompletionPortThreads: 8
MaxWorkingThreads: 200, MaxCompletionPortThreads: 8
SuperWebSocket - Total Connections: 0, Total Handled Commands: 0, Command Handling Speed: 0/s

(I can confirm packets are sent)

With mode="Sync" I get:

[.........................]
CPU Usage: 0.00%, Physical Memory Usage: 0.00, Total Thread Count: 0
AvailableWorkingThreads: 183, AvailableCompletionPortThreads: 8
MaxWorkingThreads: 200, MaxCompletionPortThreads: 8
SuperWebSocket - Total Connections: 0, Total Handled Commands: 0, Command Handling Speed: 0/s


---------------------------------------------------
CPU Usage: 0.00%, Physical Memory Usage: 0.00, Total Thread Count: 0
AvailableWorkingThreads: 183, AvailableCompletionPortThreads: 8
MaxWorkingThreads: 200, MaxCompletionPortThreads: 8
SuperWebSocket - Total Connections: 1, Total Handled Commands: 2, Command Handling Speed: 0/s
(communication worked)

I'm running mono 2.11.1 on ARM.

Apr 28, 2012 at 6:01 PM
They are performance log, is there any information in err.log and info.log?
From: [email removed]
Sent: Sunday, April 29, 2012 12:58 AM
To: [email removed]
Subject: Re: SuperWebSocket and Mono 2.11 [SuperWebSocket:353892]

From: abel_silva

With mode="Async" I only get status information

[......................]
CPU Usage: 0.00%, Physical Memory Usage: 0.00, Total Thread Count: 0
AvailableWorkingThreads: 181, AvailableCompletionPortThreads: 8
MaxWorkingThreads: 200, MaxCompletionPortThreads: 8
SuperWebSocket - Total Connections: 0, Total Handled Commands: 0, Command Handling Speed: 0/s


---------------------------------------------------
CPU Usage: 0.00%, Physical Memory Usage: 0.00, Total Thread Count: 0
AvailableWorkingThreads: 183, AvailableCompletionPortThreads: 8
MaxWorkingThreads: 200, MaxCompletionPortThreads: 8
SuperWebSocket - Total Connections: 0, Total Handled Commands: 0, Command Handling Speed: 0/s

(I can confirm packets are sent)

With mode="Sync" I get:

[.........................]
CPU Usage: 0.00%, Physical Memory Usage: 0.00, Total Thread Count: 0
AvailableWorkingThreads: 183, AvailableCompletionPortThreads: 8
MaxWorkingThreads: 200, MaxCompletionPortThreads: 8
SuperWebSocket - Total Connections: 0, Total Handled Commands: 0, Command Handling Speed: 0/s


---------------------------------------------------
CPU Usage: 0.00%, Physical Memory Usage: 0.00, Total Thread Count: 0
AvailableWorkingThreads: 183, AvailableCompletionPortThreads: 8
MaxWorkingThreads: 200, MaxCompletionPortThreads: 8
SuperWebSocket - Total Connections: 1, Total Handled Commands: 2, Command Handling Speed: 0/s
(communication worked)

I'm running mono 2.11.1 on ARM.

Apr 30, 2012 at 12:51 PM

before starting the server I run:

LogUtil.Setup(new Logger());

the Logger class is:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using SuperSocket.Common;

namespace Communications.Websocket
{
    public class Logger : ILogger
    {
        public Logger()
        {
        }

        public void Debug(string message)
        {
            Console.WriteLine(message);
        }
        public void Info(string message)
        {
            Console.WriteLine(message);
        }
        public void Warn(string message)
        {
            Console.WriteLine(message);
        }

        public void LogDebug(string message)
        {
            Console.WriteLine(message);
        }

        public void LogError(string message)
        {
            Console.WriteLine(message);
        }

        public void LogError(string title, Exception e)
        {
            Console.WriteLine(title + " - " + e.Message);
        }

        public void LogError(Exception e)
        {
            Console.WriteLine(e.Message);
        }

        public void LogInfo(string message)
        {
            Console.WriteLine(message);
        }

        public void LogPerf(string message)
        {
            Console.WriteLine(message);
        }

        public string Name
        {
            get { return "Logger"; }
        }
    }
}

With this configuration I don't get any more messages.

On windows, using microsoft .net framework, I get the same output, nothing more.

Apr 30, 2012 at 2:19 PM

Why did you implement your own log?

"LogUtil.Setup();" is enought!

Apr 30, 2012 at 2:36 PM

If you just want to ouput log through console, you can use:

LogUtil.Setup(new ConsoleLog());

Apr 30, 2012 at 3:17 PM
kerryjiang wrote:

If you just want to ouput log through console, you can use:

LogUtil.Setup(new ConsoleLog());

ConsoleLog doesn't exist, I have references for SuperSocket.Common, SuperSocket.Facility, SuperSocket.SocketBase, SuperSocket.SocketEngine, SuperWebSocket and log4net (includes an xml from distribution).

I don't get any output using LogUtil.Setup()

 

I tried renaming the log4net.xml but I get the same result, no outputs

 

I tried this on windows (with microsoft .net framework)

Apr 30, 2012 at 3:19 PM

Oh, which veresion of SuperWebSocket are you using?

Please always use the code in mainline folder.

Apr 30, 2012 at 3:23 PM

I'm with SuperWebSocket 0.6 (Release Net40)

Apr 30, 2012 at 3:32 PM

LogUtil.Setup(new ConsoleLogger());

You can find the usage in this page:
http://superwebsocket.codeplex.com/SourceControl/changeset/view/76750#1550338

Apr 30, 2012 at 5:46 PM
Edited Apr 30, 2012 at 5:53 PM
kerryjiang wrote:

LogUtil.Setup(new ConsoleLogger());

You can find the usage in this page:
http://superwebsocket.codeplex.com/SourceControl/changeset/view/76750#1550338

With

 

                    socketServer.NewMessageReceived += new SessionEventHandler(socketServer_NewMessageReceived);
                    socketServer.NewSessionConnected += new SessionEventHandler(socketServer_NewSessionConnected);
                    socketServer.SessionClosed += new SessionEventHandler(socketServer_SessionClosed);

[...]


        void socketServer_NewSessionConnected(WebSocketSession session)
        {
            Console.WriteLine("WEBSOCKET - NEW SESSION: " + session.RemoteEndPoint.Address.ToString());
[...]


        void socketServer_SessionClosed(WebSocketSession session, CloseReason reason)
        {
            Console.WriteLine("WEBSOCKET - CLOSED SESSION: " + session.RemoteEndPoint.Address.ToString());
[...]


        void socketServer_NewMessageReceived(WebSocketSession session, string e)
        {
            Console.WriteLine("WEBSOCKET - NEW MESSAGE: " + session.RemoteEndPoint.Address.ToString() + " |" + e + "|");
[...]

 

I only get output like the following:

 

[...]
WEBSOCKET - CLOSED SESSION: 10.0.3.163
WEBSOCKET - CLOSED SESSION: 10.0.3.163
WEBSOCKET - CLOSED SESSION: 10.0.3.163
WEBSOCKET - CLOSED SESSION: 10.0.3.163
WEBSOCKET - CLOSED SESSION: 10.0.3.163
WEBSOCKET - CLOSED SESSION: 10.0.3.163
[...]
Apr 30, 2012 at 5:46 PM

ConsoleLogger isn't giving me any output, still can't understand why...

May 1, 2012 at 12:02 PM

For now I'll stick with

Mode = SocketMode.Sync,
It works without any problems...

May 1, 2012 at 4:10 PM

There must be some fatal exception throw, but it cannot be logged. Can you debug into it?