Fix for issue #9 - 2

This commit is contained in:
sta
2012-10-26 14:58:50 +09:00
parent 2ae1d35d03
commit 746c883b82
71 changed files with 230 additions and 84 deletions
+4 -7
View File
@@ -1,4 +1,5 @@
using System;
using System.Threading;
using WebSocketSharp;
using WebSocketSharp.Server;
@@ -6,8 +7,7 @@ namespace Example2 {
public class Chat : WebSocketService
{
private static object _forNum = new object();
private static uint _num = 0;
private static int _num = 0;
private string _name;
@@ -18,12 +18,9 @@ namespace Example2 {
: "anon#" + getNum();
}
private uint getNum()
private int getNum()
{
lock (_forNum)
{
return ++_num;
}
return Interlocked.Increment(ref _num);
}
protected override void OnOpen(object sender, EventArgs e)
Binary file not shown.
+3 -1
View File
@@ -20,6 +20,7 @@ namespace Example2
//var wssv = new WebSocketServiceHost<Chat>(4649);
//var wssv = new WebSocketServiceHost<Chat>(4649, "/Chat");
//var wssv = new WebSocketServiceHost<Chat>(4649, "/チャット");
//wssv.Sweeped = false; // Stop the Sweep inactive session Timer.
wssv.Start();
Console.WriteLine(
@@ -27,12 +28,13 @@ namespace Example2
wssv.Uri, wssv.Address, wssv.Port);
*/
// Multi services server
/// Multi services server
var wssv = new WebSocketServer(4649);
wssv.AddService<Echo>("/Echo");
wssv.AddService<Echo>("/エコー");
wssv.AddService<Chat>("/Chat");
wssv.AddService<Chat>("/チャット");
//wssv.Sweeped = false; // Must be set after any AddService methods done.
wssv.Start();
Console.WriteLine(
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.