├── .gitignore ├── .travis.yml ├── Agent ├── ManagedAppAgent.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── SuperSocket.Agent.Net40.csproj ├── SuperSocket.Agent.Net45.csproj ├── packages.SuperSocket.Agent.Net40.config └── packages.SuperSocket.Agent.Net45.config ├── Build.bat ├── BuildQuickStart.bat ├── BuildServerManager.bat ├── BuildWithSignature.bat ├── Common ├── AssemblyUtil.cs ├── ConfigurationElementBase.cs ├── ConfigurationExtension.cs ├── DictionaryExtension.cs ├── ErrorEventArgs.cs ├── GenericConfigurationElementCollection.cs ├── Platform.cs ├── Properties │ └── AssemblyInfo.cs ├── SocketEx.cs ├── StringExtension.NET4.cs ├── StringExtension.cs ├── SuperSocket.Common.Net40.csproj ├── SuperSocket.Common.Net45.csproj └── TheadPoolEx.cs ├── Dlr ├── DynamicCommand.cs ├── DynamicCommandLoader.cs ├── DynamicCommandLoaderBase.cs ├── FileScriptSource.cs ├── IScriptSource.cs ├── Properties │ └── AssemblyInfo.cs ├── ScriptSourceBase.cs ├── SuperSocket.Dlr.Net40.csproj ├── SuperSocket.Dlr.Net45.csproj ├── packages.SuperSocket.Dlr.Net40.config └── packages.SuperSocket.Dlr.Net45.config ├── Facility ├── PolicyServer │ ├── FlashPolicyServer.cs │ ├── PolicyReceiveFilter.cs │ ├── PolicyReceiveFilterFactory.cs │ ├── PolicyServer.cs │ ├── PolicySession.cs │ └── SilverlightPolicyServer.cs ├── Properties │ └── AssemblyInfo.cs ├── SuperSocket.Facility.Net40.csproj ├── SuperSocket.Facility.Net45.csproj ├── packages.SuperSocket.Facility.Net40.config └── packages.SuperSocket.Facility.Net45.config ├── LICENSE ├── Management ├── AgentClient.SL5 │ ├── App.xaml │ ├── App.xaml.cs │ ├── Behaviors │ │ └── SelectRowOnRightClickBehavior.cs │ ├── MainPage.xaml │ ├── MainPage.xaml.cs │ ├── NodeTemplates.xaml │ ├── Properties │ │ ├── AppManifest.xml │ │ ├── AssemblyInfo.cs │ │ ├── InBrowserSettings.xml │ │ └── OutOfBrowserSettings.xml │ ├── SuperSocket.ServerManager.Client.SL5.csproj │ ├── Themes │ │ └── Default │ │ │ ├── Grid.xaml │ │ │ └── Skin.xaml │ ├── Tuple.cs │ └── ViewModel │ │ └── NodeMasterViewModel.SL.cs ├── AgentClient.WPF │ ├── AgentWebSocket.cs │ ├── App.xaml │ ├── App.xaml.cs │ ├── Behaviors │ │ └── ContextMenuBehavior.cs │ ├── Command │ │ ├── DelegateCommand.cs │ │ └── GenericDelegateCommand.cs │ ├── Config │ │ ├── AgentConfig.cs │ │ └── NodeConfig.cs │ ├── ConfigPanel.xaml │ ├── ConfigPanel.xaml.cs │ ├── Controls │ │ ├── CircleProgressBar.xaml │ │ ├── CircleProgressBar.xaml.cs │ │ └── PasswordHelper.cs │ ├── Converters │ │ ├── DebugConverter.cs │ │ ├── IsNullConverter.cs │ │ ├── NodeStateVisibilityConverter.cs │ │ └── ToStringConverter.cs │ ├── Extensions.cs │ ├── MainPanel.xaml │ ├── MainPanel.xaml.cs │ ├── MainWindow.xaml │ ├── MainWindow.xaml.cs │ ├── NodeHeader.xaml │ ├── NodeHeader.xaml.cs │ ├── NodeInfo.xaml │ ├── NodeInfo.xaml.cs │ ├── NodeTemplates.xaml │ ├── NodeTemplatesCommon.xaml │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ ├── Resources.resx │ │ ├── Settings.Designer.cs │ │ └── Settings.settings │ ├── Resources │ │ ├── SS(32).png │ │ └── SS(48).png │ ├── SS2(32).ico │ ├── SuperSocket.ServerManager.Client.WPF.csproj │ ├── Themes │ │ └── Default │ │ │ ├── Basic.xaml │ │ │ ├── Grid.xaml │ │ │ └── Skin.xaml │ └── ViewModel │ │ ├── ConfigViewModel.cs │ │ ├── MainViewModel.cs │ │ ├── NodeConfigViewModel.cs │ │ ├── NodeMasterViewModel.cs │ │ ├── NodeState.cs │ │ └── ViewModelBase.cs ├── Server │ ├── Command │ │ ├── LOGIN.cs │ │ ├── START.cs │ │ └── STOP.cs │ ├── Config │ │ ├── UserConfig.cs │ │ └── UserConfigCollection.cs │ ├── ListenersJsonConverter.cs │ ├── ManagementServer.cs │ ├── ManagementSession.cs │ ├── Model │ │ ├── CommandName.cs │ │ ├── CommandResult.cs │ │ ├── LoginInfo.cs │ │ └── LoginResult.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SuperSocket.ServerManager.Net35.csproj │ ├── SuperSocket.ServerManager.Net40.csproj │ └── SuperSocket.ServerManager.Net45.csproj ├── SuperSocket.ServerManager.Net35.sln ├── SuperSocket.ServerManager.Net45.sln └── SuperSocket.ServerManager.sln ├── ProtoBase ├── BasicStringParser.cs ├── Buffer │ ├── IBufferManager.cs │ └── NullBufferManager.cs ├── BufferList.cs ├── BufferStream.cs ├── BufferedPackageInfo.cs ├── CloseReason.cs ├── DefaultPipelineProcessor.cs ├── DefaultProtoHandler.cs ├── Encoder │ ├── IProtoDataEncoder.cs │ ├── IProtoObjectEncoder.cs │ └── IProtoTextEncoder.cs ├── ExtensionAttribute.cs ├── Extensions.cs ├── FilterState.cs ├── Func.cs ├── HttpBase │ ├── HttpHeaderInfo.cs │ ├── HttpHeaderReceiveFilterBase.cs │ └── HttpPackageInfoBase.cs ├── IBufferRecycler.cs ├── IBufferState.cs ├── IBufferedPackageInfo.cs ├── ICommunicationChannel.cs ├── IOutputBuffer.cs ├── IPackageHandler.cs ├── IPackageInfo.cs ├── IPackageResolver.cs ├── IPipelineProcessor.cs ├── IProtoHandler.cs ├── IReceiveFilter.cs ├── IStringParser.cs ├── LINQ.cs ├── MimeHeaderHelper.cs ├── PackageInfo.cs ├── ProcessResult.cs ├── ProcessState.cs ├── Properties │ ├── AssemblyInfo.Portable.cs │ └── AssemblyInfo.cs ├── ProtoHandlerBase.cs ├── ReceiveFilters │ ├── BeginEndMarkReceiveFilter.cs │ ├── CountSpliterReceiveFilter.cs │ ├── FixedHeaderReceiveFilter.cs │ ├── FixedSizeReceiveFilter.cs │ ├── SearchMarkState.cs │ ├── StateFullSearch.cs │ └── TerminatorReceiveFilter.cs ├── StringPackageInfo.cs ├── SuperSocket.ProtoBase.Net20.csproj ├── SuperSocket.ProtoBase.Net35.csproj ├── SuperSocket.ProtoBase.Net40.csproj ├── SuperSocket.ProtoBase.Net45.csproj ├── SuperSocket.ProtoBase.Portable.csproj ├── SuperSocket.ProtoBase.Portable.sln ├── SuperSocket.ProtoBase.nuspec └── dotnet │ └── project.json ├── Protocols ├── Http │ ├── HttpBodyReceiveFilter.cs │ ├── HttpHeaderKey.cs │ ├── HttpHeaderReceiveFilter.cs │ ├── HttpPackageInfo.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SuperSocket.Http.2010.NET35.sln │ ├── SuperSocket.Http.2012.sln │ ├── SuperSocket.Http.Net35.csproj │ ├── SuperSocket.Http.Net40.csproj │ ├── SuperSocket.Http.Net45.csproj │ └── SuperSocket.Http.sln ├── WebSocket.Test │ ├── BootstrapTestBase.cs │ ├── Command │ │ ├── ECHO.cs │ │ └── QUIT.cs │ ├── Config │ │ └── Basic.config │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SubProtocolWebSocketTest.cs │ ├── SuperSocket.WebSocket.Test.csproj │ ├── WebSocketClientTest.cs │ ├── WebSocketFramingTest.cs │ ├── WebSocketHybi10Test.cs │ ├── WebSocketRawTest.cs │ ├── WebSocketServer.cs │ └── WebSocketTestBase.cs └── WebSocket │ ├── Command │ ├── Binary.cs │ ├── Close.cs │ ├── Continuation.cs │ ├── FragmentCommand.cs │ ├── HandShake.cs │ ├── Ping.cs │ ├── Plain.cs │ ├── Pong.cs │ └── Text.cs │ ├── Config │ ├── CommandConfig.cs │ ├── CommandConfigCollection.cs │ ├── SubProtocolConfig.cs │ └── SubProtocolConfigCollection.cs │ ├── Encoders │ ├── Hybi00ProtoDataEncoder.cs │ ├── Hybi00ProtoTextEncoder.cs │ ├── Rfc6455ProtoDataEncoder.cs │ └── Rfc6455ProtoTextEncoder.cs │ ├── Extensions.cs │ ├── IBinaryDataConverter.cs │ ├── IBinaryDataParser.cs │ ├── IHandshakeValidator.cs │ ├── JsonWebSocketSession.cs │ ├── OpCode.cs │ ├── OpHandlers │ ├── BinaryHandler.cs │ ├── CloseHandler.cs │ ├── IOpHandler.cs │ ├── OpHandlerBase.cs │ ├── PingHandler.cs │ ├── PongHandler.cs │ └── TextHandler.cs │ ├── Properties │ ├── AssemblyInfo.Portable.cs │ └── AssemblyInfo.cs │ ├── Protocol │ ├── CloseStatusCodeHybi10.cs │ ├── CloseStatusCodeRfc6455.cs │ ├── DraftHybi00Processor.cs │ ├── DraftHybi10Processor.cs │ ├── FramePartReader │ │ ├── DataFramePartReader.cs │ │ ├── ExtendedLenghtReader.cs │ │ ├── FixPartReader.cs │ │ ├── IDataFramePartReader.cs │ │ ├── MaskKeyReader.cs │ │ └── PayloadDataReader.cs │ ├── HandshakeRequest.cs │ ├── ICloseStatusCode.cs │ ├── IProtocolProcessor.cs │ ├── IWebSocketFragment.cs │ ├── MultipleProtocolSwitchProcessor.cs │ ├── PlainFragment.cs │ ├── ProtocolProcessorBase..cs │ ├── Rfc6455Processor.cs │ ├── WebSocketDataFrame.cs │ ├── WebSocketDataFrameReceiveFilter.cs │ ├── WebSocketDataReceiveFilter.cs │ ├── WebSocketHeaderReceiveFilter.cs │ ├── WebSocketReceiveFilterBase.cs │ └── WebSocketSecKey3ReceiveFilter.cs │ ├── ReceiveFilters │ ├── DraftHybi00DataReceiveFilter.cs │ ├── DraftHybi00ReceiveFilter.cs │ ├── DraftHybi10ReceiveFilter.cs │ ├── IHandshakeHandler.cs │ ├── IWebSocketReceiveFilter.cs │ ├── MultipleProtocolSwitchReceiveFilter.cs │ ├── Rfc6455ReceiveFilter.cs │ ├── WebSocketHandshakeReceiveFilter.cs │ └── WebSocketReceiveFilterFactory.cs │ ├── SubProtocol │ ├── AsyncJsonSubCommand.cs │ ├── BasicSubCommandParser.cs │ ├── BasicSubProtocol.cs │ ├── ISubCommand.cs │ ├── ISubCommandFilterLoader.cs │ ├── ISubProtocol.cs │ ├── ISubRequestInfo.cs │ ├── JsonSubCommand.cs │ ├── JsonSubCommandBase.cs │ ├── SubCommandBase.cs │ ├── SubCommandFilterAttribute.cs │ ├── SubProtocolBase.cs │ └── SubRequestInfo.cs │ ├── SuperSocket.WebSocket.Net40.csproj │ ├── SuperSocket.WebSocket.Net45.csproj │ ├── SuperSocket.WebSocket.Portable.csproj │ ├── TextEncodingBinaryDataConverter.cs │ ├── WebSocketConst.cs │ ├── WebSocketContext.cs │ ├── WebSocketNewSessionHandler.cs │ ├── WebSocketPackageInfo.cs │ ├── WebSocketProtocol.cs │ ├── WebSocketReceiveFilterFactory.cs │ ├── WebSocketServer.cs │ ├── WebSocketServiceProvider.cs │ ├── WebSocketSession.cs │ ├── packages.SuperSocket.WebSocket.Net40.config │ └── packages.SuperSocket.WebSocket.Net45.config ├── QuickStart ├── AppDomainIsolation │ ├── SampleA │ │ ├── Command │ │ │ ├── CLOSE.cs │ │ │ └── ECHO.cs │ │ ├── Config │ │ │ ├── log4net.config │ │ │ └── log4net.unix.config │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SampleA.csproj │ │ ├── SampleServer.cs │ │ └── SuperSocket.SocketService.exe.config │ ├── SampleB │ │ ├── Command │ │ │ ├── CLOSE.cs │ │ │ └── ECHO.cs │ │ ├── Config │ │ │ ├── log4net.config │ │ │ └── log4net.unix.config │ │ ├── InstancesRoot │ │ │ ├── ServerA │ │ │ │ ├── log4net.config │ │ │ │ └── log4net.unix.config │ │ │ └── ServerB │ │ │ │ ├── log4net.config │ │ │ │ └── log4net.unix.config │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SampleB.csproj │ │ ├── SampleServer.cs │ │ └── SuperSocket.SocketService.exe.config │ └── SampleC │ │ ├── Config │ │ ├── log4net.config │ │ └── log4net.unix.config │ │ ├── InstancesRoot │ │ ├── ServerA │ │ │ ├── Command │ │ │ │ ├── ADD.py │ │ │ │ └── QUIT.py │ │ │ ├── log4net.config │ │ │ └── log4net.unix.config │ │ └── ServerB │ │ │ ├── Command │ │ │ ├── MULT.py │ │ │ └── QUIT.py │ │ │ ├── log4net.config │ │ │ └── log4net.unix.config │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── SampleC.csproj │ │ ├── SampleServer.cs │ │ └── SuperSocket.SocketService.exe.config ├── Basic │ ├── TelnetServer │ │ ├── Config │ │ │ ├── log4net.config │ │ │ └── log4net.unix.config │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── TelnetServer.csproj │ │ ├── app.config │ │ └── packages.config │ ├── TelnetServer_AppServer │ │ ├── ADD.cs │ │ ├── Config │ │ │ ├── log4net.config │ │ │ └── log4net.unix.config │ │ ├── ECHO.cs │ │ ├── MULT.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── TelnetServer.cs │ │ ├── TelnetServer_04_AppServer.csproj │ │ ├── TelnetSession.cs │ │ ├── app.config │ │ └── packages.config │ ├── TelnetServer_AppSession │ │ ├── ADD.cs │ │ ├── Config │ │ │ ├── log4net.config │ │ │ └── log4net.unix.config │ │ ├── ECHO.cs │ │ ├── MULT.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── TelnetServer_03_AppSession.csproj │ │ ├── TelnetSession.cs │ │ ├── app.config │ │ └── packages.config │ ├── TelnetServer_Command │ │ ├── ADD.cs │ │ ├── Config │ │ │ ├── log4net.config │ │ │ └── log4net.unix.config │ │ ├── ECHO.cs │ │ ├── MULT.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── TelnetServer_02_Command.csproj │ │ ├── app.config │ │ └── packages.config │ ├── TelnetServer_ProcessRequest │ │ ├── Config │ │ │ ├── log4net.config │ │ │ └── log4net.unix.config │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── TelnetServer_01_ProcessRequest.csproj │ │ ├── app.config │ │ └── packages.config │ └── TelnetServer_StartByConfig │ │ ├── ADD.cs │ │ ├── App.config │ │ ├── Config │ │ ├── log4net.config │ │ └── log4net.unix.config │ │ ├── ECHO.cs │ │ ├── MULT.cs │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── TelnetServer.cs │ │ ├── TelnetServer_05_StartByConfig.csproj │ │ ├── TelnetSession.cs │ │ └── packages.config ├── BroadcastService │ ├── BroadcastServer.cs │ ├── BroadcastService.csproj │ ├── BroadcastSession.cs │ ├── Command │ │ ├── BROA.cs │ │ └── CONN.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── SuperSocket.SocketService.exe.config ├── CommandFilter │ ├── CommandFilter.csproj │ ├── CountCommandFilter.cs │ ├── LOGIN.cs │ ├── LogTimeCommandFilter.cs │ ├── LoggedInValidationFilter.cs │ ├── MyAppServer.cs │ ├── MyAppSession.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── QUERY.cs │ └── packages.config ├── ConfigSample │ ├── CustomLogFactory.config │ ├── MultipleListenersA.exe.config │ ├── MultipleListenersB.exe.config │ ├── MultipleListenersC.exe.config │ ├── PolicyServer.exe.config │ ├── SecureServerA.config │ └── SecureServerB.config ├── ConnectionFilter │ ├── ConnectionFilter.csproj │ ├── IPConnectionFilter.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── SuperSocket.SocketService.exe.config ├── CountSpliterProtocol │ ├── Command │ │ └── ECHO.cs │ ├── CountSpliterAppServer.cs │ ├── CountSpliterProtocol.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SuperSocket.config │ └── UnitTest.cs ├── CustomProtocol │ ├── Command │ │ └── ECHO.cs │ ├── CustomProtocol.csproj │ ├── CustomProtocolServer.cs │ ├── CustomProtocolServerTest.cs │ ├── CustomProtocolSession.cs │ ├── MyReceiveFilter.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SuperSocket.SocketService.exe.config │ └── packages.config ├── CustomRequestInfoParser │ ├── Command │ │ └── ECHO.cs │ ├── CustomRequestInfoParser.csproj │ ├── CustomStringParser.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SuperSocket.SocketService.exe.config │ ├── TestSocketServer.cs │ ├── YourServer.cs │ ├── YourSession.cs │ └── packages.config ├── GPSSocketServer │ ├── Command │ │ ├── BinaryPackageInfo.cs │ │ ├── KeepAlive.cs │ │ └── Position.cs │ ├── GPSReceiveFilter.cs │ ├── GPSServer.cs │ ├── GPSServerTest.cs │ ├── GPSSession.cs │ ├── GPSSocketServer.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SuperSocket.SocketService.exe.config │ └── packages.config ├── IronSocketServer │ ├── Command │ │ ├── IronPythonServer │ │ │ ├── ADD.py │ │ │ └── MULT.py │ │ └── QUIT.py │ ├── DynamicAppServer.cs │ ├── IronSocketServer.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── SuperSocket.SocketService.exe.config ├── MultipleAppServer │ ├── DESP.cs │ ├── IDespatchServer.cs │ ├── MultipleAppServer.csproj │ ├── MyAppServerA.cs │ ├── MyAppServerB.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── SuperSocket.SocketService.exe.config ├── MultipleCommandAssembly │ ├── CommandAssemblyA │ │ ├── ADD.cs │ │ ├── CommandAssemblyA.csproj │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── CommandAssemblyB │ │ ├── CommandAssemblyB.csproj │ │ ├── ECHO.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── CommandAssemblyC │ │ ├── CommandAssemblyC.csproj │ │ ├── MULT.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ └── SampleServer │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── SampleAppServer.cs │ │ ├── SampleServer.csproj │ │ └── SuperSocket.SocketService.exe.config ├── QuickStart.2012.sln ├── QuickStart.sln ├── RemoteProcessService │ ├── Command │ │ ├── FROZ.cs │ │ ├── KILL.cs │ │ ├── LIST.cs │ │ └── QUIT.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── RemoteProcessServer.cs │ ├── RemoteProcessService.csproj │ ├── RemoteProcessSession.cs │ ├── SuperSocket.SocketService.exe.config │ └── packages.config ├── ServerManagerSample │ ├── Config │ │ ├── Silverlight.config │ │ ├── log4net.config │ │ └── log4net.unix.config │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SampleServer.cs │ ├── ServerManagerSample.csproj │ └── SuperSocket.SocketService.exe.config ├── ServerPush │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── PushServer.cs │ ├── ServerPush.csproj │ ├── SuperSocket.SocketService.exe.config │ └── packages.config ├── SwitchReceiveFilter │ ├── ECHO.cs │ ├── MyAppServer.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ReceiveFilterA.cs │ ├── ReceiveFilterB.cs │ ├── SwitchReceiveFilter.cs │ ├── SwitchReceiveFilter.csproj │ ├── Test.cs │ └── packages.config ├── TerminatorProtocol │ ├── Config │ │ ├── log4net.config │ │ └── log4net.unix.config │ ├── ECHO.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── SuperSocket.config │ ├── TerminatorProtocol.csproj │ ├── TerminatorProtocolServer.cs │ └── UnitTest.cs └── WindowsAzure │ ├── AzureHost │ ├── AzureHost.ccproj │ ├── ServiceConfiguration.cscfg │ ├── ServiceDefinition.build.csdef │ └── ServiceDefinition.csdef │ ├── Cloud.sln │ └── SuperSocketRole │ ├── Config │ └── log4net.config │ ├── Properties │ └── AssemblyInfo.cs │ ├── SuperSocketRole.csproj │ ├── WorkerRole.cs │ └── app.config ├── README.md ├── Reference ├── Blend │ ├── net40 │ │ ├── Microsoft.Expression.Interactions.dll │ │ ├── Microsoft.Expression.Interactions.xml │ │ ├── System.Windows.Interactivity.dll │ │ └── System.Windows.Interactivity.xml │ ├── sl40 │ │ ├── Microsoft.Expression.Interactions.dll │ │ ├── Microsoft.Expression.Interactions.xml │ │ ├── System.Windows.Interactivity.dll │ │ └── System.Windows.Interactivity.xml │ ├── sl50 │ │ ├── Microsoft.Expression.Interactions.dll │ │ ├── Microsoft.Expression.Interactions.xml │ │ ├── System.Windows.Interactivity.dll │ │ └── System.Windows.Interactivity.xml │ └── wp71 │ │ ├── Microsoft.Expression.Interactions.dll │ │ ├── Microsoft.Expression.Interactions.xml │ │ ├── System.Windows.Interactivity.dll │ │ └── System.Windows.Interactivity.xml ├── DLR │ ├── Net35 │ │ ├── Microsoft.Dynamic.dll │ │ ├── Microsoft.Dynamic.xml │ │ ├── Microsoft.Scripting.Core.dll │ │ ├── Microsoft.Scripting.Core.xml │ │ ├── Microsoft.Scripting.dll │ │ └── Microsoft.Scripting.xml │ └── Net40 │ │ ├── Microsoft.Dynamic.dll │ │ ├── Microsoft.Dynamic.xml │ │ ├── Microsoft.Scripting.dll │ │ └── Microsoft.Scripting.xml ├── DynamicViewModel │ ├── Net40 │ │ ├── DynamicViewModel.dll │ │ └── DynamicViewModel.pdb │ └── SL │ │ ├── DynamicViewModel.SL.dll │ │ └── DynamicViewModel.SL.pdb ├── IronPython │ ├── Net35 │ │ ├── IronPython.dll │ │ └── IronPython.xml │ └── Net40 │ │ ├── IronPython.dll │ │ └── IronPython.xml ├── Json.NET │ ├── Net35 │ │ ├── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.xml │ ├── Net40 │ │ ├── Newtonsoft.Json.dll │ │ └── Newtonsoft.Json.xml │ └── Portable │ │ ├── Newtonsoft.Json.dll │ │ ├── Newtonsoft.Json.pdb │ │ └── Newtonsoft.Json.xml ├── SilverlightToolkit │ ├── 40 │ │ ├── System.Windows.Controls.Input.Toolkit.dll │ │ ├── System.Windows.Controls.Input.Toolkit.xml │ │ ├── System.Windows.Controls.Toolkit.dll │ │ └── System.Windows.Controls.Toolkit.xml │ └── 50 │ │ ├── System.Windows.Controls.Data.Toolkit.dll │ │ ├── System.Windows.Controls.Data.Toolkit.xml │ │ ├── System.Windows.Controls.Input.Toolkit.dll │ │ ├── System.Windows.Controls.Input.Toolkit.xml │ │ ├── System.Windows.Controls.Toolkit.dll │ │ └── System.Windows.Controls.Toolkit.xml ├── System.Threading.dll ├── WebSocket4Net │ ├── monodroid22 │ │ ├── Debug │ │ │ ├── WebSocket4Net.dll │ │ │ ├── WebSocket4Net.dll.mdb │ │ │ └── WebSocket4Net.pdb │ │ └── Release │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ ├── net20 │ │ ├── Debug │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ │ └── Release │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ ├── net35 │ │ ├── Debug │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ │ └── Release │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ ├── net40 │ │ ├── Debug │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ │ └── Release │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ ├── net45 │ │ ├── Debug │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ │ └── Release │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ ├── sl40-windowsphone71 │ │ ├── Debug │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ │ └── Release │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ ├── sl40 │ │ ├── Debug │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ │ └── Release │ │ │ ├── WebSocket4Net.dll │ │ │ └── WebSocket4Net.pdb │ └── sl50 │ │ ├── Debug │ │ ├── WebSocket4Net.dll │ │ └── WebSocket4Net.pdb │ │ └── Release │ │ ├── WebSocket4Net.dll │ │ └── WebSocket4Net.pdb └── nunit.framework.dll ├── ReleaseProtoBase.bat ├── SocketBase ├── AppContext.cs ├── AppServer.cs ├── AppServerBase.ConfigHotUpdate.cs ├── AppServerBase.Net45.cs ├── AppServerBase.cs ├── AppSession.cs ├── Async.cs ├── Command │ ├── CommandBase.cs │ ├── CommandInfo.cs │ ├── CommandLoaderBase.cs │ ├── CommandUpdateEventArgs.cs │ ├── CommandUpdateInfo.cs │ ├── ICommand.cs │ ├── ICommandFilterProvider.cs │ ├── ICommandLoader.cs │ ├── ReflectCommandLoader.cs │ └── StringCommandBase.cs ├── CommandExecutingContext.cs ├── CompositeTargets │ ├── CommandLoaderCompositeTarget.cs │ ├── CompositeTargetBase.cs │ ├── ConnectionFilterCompositeTarget.cs │ ├── LoggerFactoryCompositeTarget.cs │ ├── MultipleResultCompositeTarget.cs │ ├── ReceiveFilterFactoryCompositeTarget.cs │ ├── SingleResultCompositeTarget.cs │ └── SocketServerFactoryComositeTarget.cs ├── Config │ ├── BufferPoolConfig.cs │ ├── CertificateConfig.cs │ ├── CommandAssemblyConfig.cs │ ├── ConfigurationSource.cs │ ├── HotUpdateAttribute.cs │ ├── IBufferPoolConfig.cs │ ├── ICertificateConfig.cs │ ├── ICommandAssemblyConfig.cs │ ├── IConfigurationSource.cs │ ├── IListenerConfig.cs │ ├── IRootConfig.Net45.cs │ ├── IRootConfig.cs │ ├── IServerConfig.Net45.cs │ ├── IServerConfig.cs │ ├── ITypeProvider.cs │ ├── ListenerConfig.cs │ ├── RootConfig.Net45.cs │ ├── RootConfig.cs │ ├── ServerConfig.Net45.cs │ ├── ServerConfig.cs │ ├── TypeProvider.cs │ ├── TypeProviderCollection.cs │ └── TypeProviderConfig.cs ├── DictionarySessionContainer.cs ├── Extensions.cs ├── IActiveConnector.cs ├── IAppServer.cs ├── IAppSession.cs ├── IBootstrap.cs ├── ICompositeTarget.cs ├── IConnectionFilter.cs ├── IManagedApp.cs ├── INewSessionHandler.cs ├── ISessionBase.cs ├── ISessionContainer.cs ├── ISocketServer.cs ├── ISocketServerFactory.cs ├── ISocketSession.cs ├── IStatusInfoSource.cs ├── ISystemEndPoint.cs ├── IWorkItem.cs ├── IsolationMode.cs ├── ListenerInfo.cs ├── LoggerExtension.cs ├── Metadata │ ├── AppServerMetadata.cs │ ├── AppServerMetadataTypeAttribute.cs │ ├── CommandAttribute.cs │ ├── CommandFilterAttribute.cs │ ├── StatusInfoAttribute.cs │ └── StatusInfoKeys.cs ├── NodeStatus.cs ├── Pool │ ├── BufferItemCreator.cs │ ├── BufferManager.cs │ ├── BufferPool.cs │ ├── IBufferPool.cs │ ├── IPool.cs │ ├── IPoolItemCreator.cs │ ├── IPoolableItem.cs │ ├── IntelliPool.cs │ └── PoolableItem.cs ├── Properties │ └── AssemblyInfo.cs ├── Protocol │ ├── CommandLineReceiveFilterFactory.cs │ ├── CountSpliterReceiveFilter.cs │ ├── CountSpliterReceiveFilterFactory.cs │ ├── DefaultProtoSender.cs │ ├── DefaultReceiveFilterFactory.cs │ ├── EncodeProtoSender.cs │ ├── IProtoSender.cs │ ├── IProtocolFactory.cs │ ├── IReceiveFilterFactory.cs │ ├── NewLineProtoTextEncoder.cs │ ├── TerminatorReceiveFilter.cs │ ├── TerminatorReceiveFilterFactory.cs │ └── UdpPackageInfo.cs ├── ProtocolMode.cs ├── Provider │ ├── IProviderMetadata.cs │ └── ProviderMetadataAttribute.cs ├── RequestHandler.cs ├── RequestHandlingMode.cs ├── Scheduler │ ├── CustomThreadPoolTaskScheduler.cs │ └── SingleThreadTaskScheduler.cs ├── Security │ └── CertificateManager.cs ├── ServerResource │ ├── BufferManagerResource.cs │ ├── RequestExecutingContextPoolResource.cs │ ├── RequestHandlingSchedulerResource.cs │ └── ServerResourceItem.cs ├── ServerState.cs ├── SessionHandler.cs ├── SocketMode.cs ├── StatusInfoCollection.cs ├── SuperSocket.SocketBase.Net40.csproj ├── SuperSocket.SocketBase.Net45.csproj ├── SuperSocket.SocketBase.Net45.csproj.config ├── Utils │ ├── ISendingQueue.cs │ ├── ITransactionGroup.cs │ ├── ITransactionItem.cs │ ├── LightweightTransaction.cs │ ├── SendingQueue.cs │ ├── SendingQueueSourceCreator.cs │ └── SendingQueueV2.cs ├── packages.SuperSocket.SocketBase.Net40.config └── packages.SuperSocket.SocketBase.Net45.config ├── SocketEngine ├── AppDomainAppServer.StatusInfo.cs ├── AppDomainAppServer.cs ├── AppDomainBootstrap.cs ├── AssemblyImport.cs ├── AsyncSocketServer.cs ├── AsyncSocketSession.cs ├── AsyncStreamSocketSession.cs ├── BootstrapFactory.cs ├── BufferState.cs ├── BufferStateCreator.cs ├── Configuration │ ├── BufferPoolConfig.cs │ ├── CertificateConfig.cs │ ├── CommandAssembly.cs │ ├── Listener.cs │ ├── Server.Net45.cs │ ├── Server.cs │ ├── ServerCollection.cs │ ├── SocketServiceConfig.Net45.cs │ └── SocketServiceConfig.cs ├── ConfigurationWatcher.cs ├── DefaultBootstrap.Net45.cs ├── DefaultBootstrap.cs ├── IAsyncSocketEventComplete.cs ├── IAsyncSocketSession.cs ├── IExceptionSource.cs ├── IPerformanceMonitor.cs ├── IProcessServer.cs ├── IRemoteManagedApp.cs ├── ISocketListener.cs ├── IsolationAppServer.cs ├── MarshalAppServer.cs ├── PerformanceMonitor.cs ├── ProcessAppServer.cs ├── ProcessBootstrap.cs ├── ProcessLocker.cs ├── ProcessPerformanceCounterHelper.cs ├── Properties │ └── AssemblyInfo.cs ├── RemoteBootstrapProxy.cs ├── SaeState.cs ├── SaeStateCreator.cs ├── ServerResource │ ├── BufferStatePoolResource.cs │ ├── SaePoolResource.cs │ └── SendingQueuePoolResource.cs ├── ServerTypeMetadata.cs ├── SocketListenerBase.cs ├── SocketServerBase.cs ├── SocketServerFactory.cs ├── SocketSession.Net.cs ├── SocketSession.Net45.cs ├── SocketSession.cs ├── SuperSocket.SocketEngine.Net40.csproj ├── SuperSocket.SocketEngine.Net45.csproj ├── TcpAsyncSocketListener.cs ├── TcpSocketServerBase.cs ├── TypeValidator.cs ├── UdpSocketListener.cs ├── UdpSocketServer.cs ├── UdpSocketSession.cs ├── packages.SuperSocket.SocketEngine.Net40.config └── packages.SuperSocket.SocketEngine.Net45.config ├── SocketService ├── ControlCommand.cs ├── MainService.Designer.cs ├── MainService.cs ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── SelfInstaller.cs ├── SocketServiceInstaller.Designer.cs ├── SocketServiceInstaller.cs ├── SuperSocket.SocketService.Net40.csproj ├── SuperSocket.SocketService.Net45.csproj ├── supersocket.cmd └── supersocket.sh ├── Solution Items ├── GlobalAssemblyInfo.cs ├── Net40 │ ├── App.Dynamic.config │ └── App.config ├── Net45 │ ├── App.Dynamic.config │ └── App.config ├── log4net.config └── log4net.unix.config ├── SuperSocket-Net40.sln ├── SuperSocket-Net45.sln ├── SuperSocket-VS2010-Net40.sln ├── SuperSocket.Portable.sln ├── SuperSocket.ProtoBase.nuspec ├── SuperSocket.ProtoBase.sln ├── SuperSocket.WebSocket-Net45.sln ├── SuperSocket.WebSocket.VS2010.sln ├── SuperSocket.build ├── SuperSocket.msbuild ├── SuperSocket.nuspec ├── Test ├── AppDomainSocketServerTest.cs ├── BootstrapTest.Net45.cs ├── BootstrapTest.cs ├── BootstrapTestBase.cs ├── ChildConfigTestServer.cs ├── Command │ ├── ADD.py │ ├── ADDCS.cs │ ├── ADDR.cs │ ├── CLOSE.cs │ ├── CULT.cs │ ├── DOMAIN.cs │ ├── ECHO.cs │ ├── MULT.py │ ├── MULTCS.cs │ ├── NUM.cs │ ├── PARA.cs │ ├── PROC.cs │ ├── RESU.cs │ ├── SEND.cs │ └── SESS.cs ├── Common │ ├── AssemblyUtilTest.cs │ └── PerformanceTest.cs ├── Config │ ├── ActiveConnectServer.config │ ├── AppDomain.config │ ├── AppDomainTestServer.config │ ├── Basic.config │ ├── ChildConfig.cs │ ├── ChildConfigA.config │ ├── ChildConfigB.config │ ├── ChildConfigC.config │ ├── ChildConfigD.config │ ├── ConnectionFilter.config │ ├── DLR.config │ ├── DefaultCultureA.config │ ├── DefaultCultureB.config │ ├── DefaultCultureC.config │ ├── Listeners.config │ ├── ProcessIsolation.config │ ├── ProcessTestServer.config │ ├── SecureTestServer.config │ ├── ServerType.config │ └── TestServer.config ├── ConnectionFilter │ └── TestConnectionFilter.cs ├── ConnectionFilterTest.cs ├── DLRSocketServerTest.cs ├── ITestSetup.cs ├── ProcessSocketServerTest.cs ├── Properties │ └── AssemblyInfo.cs ├── ProtoBase │ └── BufferListStreamTest.cs ├── Protocol │ ├── BeginEndMarkProtocolTest.cs │ ├── CountSpliterProtocolTest.cs │ ├── FixedHeaderProtocolTest.cs │ ├── FixedSizeProtocolTest.cs │ ├── ProtocolTestBase.cs │ └── TerminatorProtocolTest.cs ├── SecureTcpSocketServerTest.cs ├── Setup.cs ├── SocketServerTest.cs ├── Strings.txt ├── SuperSocket.Test.NET35.csproj ├── SuperSocket.Test.Net40.csproj ├── SuperSocket.Test.Net45.csproj ├── TcpSocketServerTest.cs ├── TestRequestParser.cs ├── TestServer.cs ├── TestSession.cs ├── Udp │ ├── MyReceiveFilter.cs │ ├── MyUdpProtocol.cs │ ├── SESS.cs │ ├── UdpAppServer.cs │ └── UdpTestSession.cs ├── UdpSocketServerTest.cs ├── packages.config └── supersocket.pfx ├── WARNING.txt └── supersocket.xsd /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | obj 3 | _ReSharper.* 4 | *.suo 5 | *.user 6 | *.lock.json -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | script: 3 | - nuget restore SuperSocket-Net40.sln 4 | - xbuild SuperSocket-Net40.sln 5 | - nuget restore SuperSocket-Net45.sln 6 | - xbuild SuperSocket-Net45.sln 7 | -------------------------------------------------------------------------------- /Agent/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("SuperSocket.Agent")] 6 | [assembly: AssemblyDescription("SuperSocket.Agent")] 7 | [assembly: ComVisible(false)] 8 | [assembly: Guid("bae8bfe5-07a0-47aa-9e2d-9e2a5e8bf068")] 9 | -------------------------------------------------------------------------------- /Agent/packages.SuperSocket.Agent.Net40.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Agent/packages.SuperSocket.Agent.Net45.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /BuildQuickStart.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set fdir=%WINDIR%\Microsoft.NET\Framework64 4 | 5 | if not exist %fdir% ( 6 | set fdir=%WINDIR%\Microsoft.NET\Framework 7 | ) 8 | 9 | set msbuild=%fdir%\v4.0.30319\msbuild.exe 10 | 11 | %msbuild% QuickStart\QuickStart.sln /p:Configuration=Debug /t:Rebuild 12 | pause -------------------------------------------------------------------------------- /Common/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SuperSocket.Common")] 9 | [assembly: AssemblyDescription("SuperSocket.Common")] 10 | [assembly: AssemblyConfiguration("")] 11 | // Setting ComVisible to false makes the types in this assembly not visible 12 | // to COM components. If you need to access a type in this assembly from 13 | // COM, set the ComVisible attribute to true on that type. 14 | [assembly: ComVisible(false)] 15 | 16 | // The following GUID is for the ID of the typelib if this project is exposed to COM 17 | [assembly: Guid("8056596a-0926-47ad-9f2f-6adad34fdba3")] 18 | -------------------------------------------------------------------------------- /Common/StringExtension.NET4.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.Common 7 | { 8 | /// 9 | /// String extension 10 | /// 11 | public static partial class StringExtension 12 | { 13 | /// 14 | /// Tries parse string to enum. 15 | /// 16 | /// the enum type 17 | /// The value. 18 | /// if set to true [ignore case]. 19 | /// The enum value. 20 | /// 21 | public static bool TryParseEnum(this string value, bool ignoreCase, out T enumValue) 22 | where T : struct 23 | { 24 | return Enum.TryParse(value, ignoreCase, out enumValue); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Dlr/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("SuperSocket.Dlr")] 6 | [assembly: AssemblyDescription("SuperSocket.Dlr")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: ComVisible(false)] 9 | [assembly: Guid("b80547cb-07f8-4873-8abb-aef72949aab2")] 10 | -------------------------------------------------------------------------------- /Dlr/packages.SuperSocket.Dlr.Net40.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Dlr/packages.SuperSocket.Dlr.Net45.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Facility/PolicyServer/PolicySession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net.Sockets; 5 | using System.Text; 6 | using SuperSocket.ProtoBase; 7 | using SuperSocket.SocketBase; 8 | using SuperSocket.SocketBase.Protocol; 9 | 10 | namespace SuperSocket.Facility.PolicyServer 11 | { 12 | /// 13 | /// PolicySession 14 | /// 15 | public class PolicySession : AppSession 16 | { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Facility/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("SuperSocket.Facility")] 6 | [assembly: AssemblyDescription("SuperSocket.Facility")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: ComVisible(false)] 9 | [assembly: Guid("341d2163-09a9-4f60-813f-366405715898")] 10 | -------------------------------------------------------------------------------- /Facility/packages.SuperSocket.Facility.Net40.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Facility/packages.SuperSocket.Facility.Net45.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Management/AgentClient.SL5/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Management/AgentClient.SL5/MainPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | -------------------------------------------------------------------------------- /Management/AgentClient.SL5/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Documents; 8 | using System.Windows.Input; 9 | using System.Windows.Media; 10 | using System.Windows.Media.Animation; 11 | using System.Windows.Shapes; 12 | 13 | namespace SuperSocket.ServerManager.Client 14 | { 15 | public partial class MainPage : UserControl 16 | { 17 | public MainPage() 18 | { 19 | InitializeComponent(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Management/AgentClient.SL5/Properties/AppManifest.xml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Management/AgentClient.SL5/Properties/InBrowserSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Management/AgentClient.SL5/Properties/OutOfBrowserSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | SuperSocket ServerManager Client on your desktop; at home, at work or on the go. 3 | 4 | 5 | 6 | 7 | Resources/SS(32).png 8 | Resources/SS(48).png 9 | 10 | -------------------------------------------------------------------------------- /Management/AgentClient.SL5/Themes/Default/Skin.xaml: -------------------------------------------------------------------------------- 1 |  4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/AgentWebSocket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using WebSocket4Net; 6 | using Newtonsoft.Json; 7 | using Newtonsoft.Json.Linq; 8 | using System.Dynamic; 9 | 10 | namespace SuperSocket.ServerManager.Client 11 | { 12 | class AgentWebSocket : JsonWebSocket 13 | { 14 | public AgentWebSocket(string uri) 15 | : base(uri) 16 | { 17 | 18 | } 19 | 20 | protected override string SerializeObject(object target) 21 | { 22 | return JsonConvert.SerializeObject(target); 23 | } 24 | 25 | protected override object DeserializeObject(string json, Type type) 26 | { 27 | return JsonConvert.DeserializeObject(json, type); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/Config/NodeConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Xml.Serialization; 6 | 7 | namespace SuperSocket.ServerManager.Client.Config 8 | { 9 | #if !SILVERLIGHT 10 | [Serializable] 11 | #endif 12 | public class NodeConfig 13 | { 14 | [XmlAttribute] 15 | public string Name { get; set; } 16 | 17 | [XmlAttribute] 18 | public string Uri { get; set; } 19 | 20 | [XmlAttribute] 21 | public string UserName { get; set; } 22 | 23 | [XmlAttribute] 24 | public string Password { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/Converters/DebugConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Data; 6 | 7 | namespace SuperSocket.ServerManager.Client.Converters 8 | { 9 | public class DebugConverter : IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 12 | { 13 | return value; 14 | } 15 | 16 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 17 | { 18 | return value; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/Converters/ToStringConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows.Data; 6 | 7 | namespace SuperSocket.ServerManager.Client.Converters 8 | { 9 | public class ToStringConverter : IValueConverter 10 | { 11 | public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 12 | { 13 | return value.ToString(); 14 | } 15 | 16 | public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) 17 | { 18 | throw new NotImplementedException(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/MainWindow.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace SuperSocket.ServerManager.Client 16 | { 17 | /// 18 | /// Interaction logic for MainWindow.xaml 19 | /// 20 | public partial class MainWindow : Window 21 | { 22 | public MainWindow() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/NodeHeader.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Windows; 6 | using System.Windows.Controls; 7 | using System.Windows.Data; 8 | using System.Windows.Documents; 9 | using System.Windows.Input; 10 | using System.Windows.Media; 11 | using System.Windows.Media.Imaging; 12 | using System.Windows.Navigation; 13 | using System.Windows.Shapes; 14 | 15 | namespace SuperSocket.ServerManager.Client 16 | { 17 | /// 18 | /// Interaction logic for NodeHeader.xaml 19 | /// 20 | public partial class NodeHeader : UserControl 21 | { 22 | public NodeHeader() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/NodeInfo.xaml: -------------------------------------------------------------------------------- 1 |  8 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/Resources/SS(32).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Management/AgentClient.WPF/Resources/SS(32).png -------------------------------------------------------------------------------- /Management/AgentClient.WPF/Resources/SS(48).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Management/AgentClient.WPF/Resources/SS(48).png -------------------------------------------------------------------------------- /Management/AgentClient.WPF/SS2(32).ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Management/AgentClient.WPF/SS2(32).ico -------------------------------------------------------------------------------- /Management/AgentClient.WPF/Themes/Default/Skin.xaml: -------------------------------------------------------------------------------- 1 |  3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Management/AgentClient.WPF/ViewModel/NodeState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ServerManager.Client.ViewModel 7 | { 8 | public enum NodeState 9 | { 10 | Offline, 11 | Connecting, 12 | Logging, 13 | Connected 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Management/Server/Config/UserConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.Common; 6 | using System.Configuration; 7 | 8 | namespace SuperSocket.ServerManager.Config 9 | { 10 | /// 11 | /// User configuration 12 | /// 13 | public class UserConfig : ConfigurationElementBase 14 | { 15 | /// 16 | /// Gets the password. 17 | /// 18 | [ConfigurationProperty("password", IsRequired = true)] 19 | public string Password 20 | { 21 | get 22 | { 23 | return (string)this["password"]; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Management/Server/ManagementSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.WebSocket; 7 | 8 | namespace SuperSocket.ServerManager 9 | { 10 | /// 11 | /// Management session 12 | /// 13 | public class ManagementSession : WebSocketSession 14 | { 15 | /// 16 | /// Gets the app server. 17 | /// 18 | public new ManagementServer AppServer 19 | { 20 | get { return (ManagementServer)base.AppServer; } 21 | } 22 | 23 | /// 24 | /// Gets a value indicating whether [logged in]. 25 | /// 26 | /// 27 | /// true if [logged in]; otherwise, false. 28 | /// 29 | public bool LoggedIn { get; internal set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Management/Server/Model/CommandName.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ServerManager.Model 7 | { 8 | /// 9 | /// Predefined command names 10 | /// 11 | public class CommandName 12 | { 13 | /// 14 | /// Server infromation update 15 | /// 16 | public const string UPDATE = "UPDATE"; 17 | 18 | /// 19 | /// Login 20 | /// 21 | public const string LOGIN = "LOGIN"; 22 | 23 | /// 24 | /// Start server instance 25 | /// 26 | public const string START = "START"; 27 | 28 | /// 29 | /// Stop server instance 30 | /// 31 | public const string STOP = "STOP"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Management/Server/Model/LoginInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ServerManager.Model 7 | { 8 | /// 9 | /// Login information 10 | /// 11 | public class LoginInfo 12 | { 13 | /// 14 | /// Gets or sets the name of the user. 15 | /// 16 | /// 17 | /// The name of the user. 18 | /// 19 | public string UserName { get; set; } 20 | 21 | /// 22 | /// Gets or sets the password. 23 | /// 24 | /// 25 | /// The password. 26 | /// 27 | public string Password { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Management/Server/Model/LoginResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Metadata; 7 | 8 | namespace SuperSocket.ServerManager.Model 9 | { 10 | /// 11 | /// Login command result 12 | /// 13 | public class LoginResult : CommandResult 14 | { 15 | /// 16 | /// Gets or sets the server metadata source. 17 | /// 18 | /// 19 | /// The server metadata source. 20 | /// 21 | public List> ServerMetadataSource { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Management/Server/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SuperSocket.Management.Server")] 9 | [assembly: AssemblyDescription("SuperSocket.Management.Server, it is developed for server instances management")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: ComVisible(false)] 12 | [assembly: Guid("35548653-7b6f-4f7e-8cf1-4ce1ceea82c3")] 13 | -------------------------------------------------------------------------------- /ProtoBase/Buffer/IBufferManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace SuperSocket.ProtoBase 5 | { 6 | /// 7 | /// The buffer manager interface 8 | /// 9 | public interface IBufferManager 10 | { 11 | /// 12 | /// Gets the buffer. 13 | /// 14 | /// The size of the resired buffer. 15 | /// 16 | byte[] GetBuffer(int size); 17 | 18 | /// 19 | /// Returns the buffer. 20 | /// 21 | /// The buffer. 22 | void ReturnBuffer(byte[] buffer); 23 | 24 | /// 25 | /// Shrinks this instance. 26 | /// 27 | void Shrink(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ProtoBase/DefaultProtoHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SuperSocket.ProtoBase 6 | { 7 | /// 8 | /// Default implementation of ProtoHandler 9 | /// 10 | public class DefaultProtoHandler : ProtoHandlerBase 11 | { 12 | /// 13 | /// Determines whether this instance can send. 14 | /// 15 | /// 16 | public override bool CanSend() 17 | { 18 | return true; 19 | } 20 | 21 | /// 22 | /// Closes the specified channel. 23 | /// 24 | /// The channel. 25 | /// The reason. 26 | public override void Close(ICommunicationChannel channel, CloseReason reason) 27 | { 28 | channel.Close(reason); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ProtoBase/Encoder/IProtoObjectEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | 6 | namespace SuperSocket.ProtoBase.Encoder 7 | { 8 | /// 9 | /// The object protocol encoder 10 | /// 11 | public interface IProtoObjectEncoder 12 | { 13 | /// 14 | /// Encode object 15 | /// 16 | /// the output buffer 17 | /// the object to be encoded 18 | void EncodeObject(IOutputBuffer output, object target); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ProtoBase/Encoder/IProtoTextEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ProtoBase 7 | { 8 | /// 9 | /// The interface for protocol encoder of text messages 10 | /// 11 | public interface IProtoTextEncoder 12 | { 13 | /// 14 | /// Encode text message 15 | /// 16 | /// the output buffer 17 | /// the message to be encoded 18 | /// the output binary data 19 | void EncodeText(IOutputBuffer output, string message); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ProtoBase/ExtensionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace System.Runtime.CompilerServices 6 | { 7 | [AttributeUsage(AttributeTargets.Method)] 8 | public sealed class ExtensionAttribute : Attribute 9 | { 10 | public ExtensionAttribute() { } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /ProtoBase/FilterState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ProtoBase 7 | { 8 | /// 9 | /// Filter state enum 10 | /// 11 | public enum FilterState : byte 12 | { 13 | /// 14 | /// Normal state 15 | /// 16 | Normal = 0, 17 | /// 18 | /// Error state 19 | /// 20 | Error = 1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ProtoBase/Func.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace System 6 | { 7 | public delegate TResult Func(); 8 | 9 | public delegate TResult Func(T t); 10 | 11 | public delegate TResult Func(T1 t1, T2 t2); 12 | 13 | public delegate TResult Func(T1 t1, T2 t2, T3 t3); 14 | 15 | public delegate TResult Func(T1 t1, T2 t2, T3 t3, T4 t4); 16 | } 17 | -------------------------------------------------------------------------------- /ProtoBase/IBufferedPackageInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ProtoBase 7 | { 8 | /// 9 | /// The interface for buffered package info 10 | /// 11 | public interface IBufferedPackageInfo 12 | { 13 | /// 14 | /// Gets the buffered data. 15 | /// 16 | /// 17 | /// The buffered data. 18 | /// 19 | IList> Data { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ProtoBase/ICommunicationChannel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SuperSocket.ProtoBase 6 | { 7 | /// 8 | /// The interface for communication channel 9 | /// 10 | public interface ICommunicationChannel 11 | { 12 | /// 13 | /// Send the binary segment to the other endpoint through this communication channel 14 | /// 15 | /// the data segment to be sent 16 | void Send(ArraySegment segment); 17 | 18 | /// 19 | /// Close the communication channel 20 | /// 21 | /// The reason. 22 | void Close(CloseReason reason); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ProtoBase/IOutputBuffer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SuperSocket.ProtoBase 5 | { 6 | 7 | /// 8 | /// The output buffer interface 9 | /// 10 | public interface IOutputBuffer 11 | { 12 | /// 13 | /// add single one item into the queue 14 | /// 15 | /// the item to be inserted 16 | void Add(ArraySegment item); 17 | 18 | /// 19 | /// add multiple items into the queue 20 | /// 21 | /// the multiple items to be inserted 22 | void AddRange(IList> items); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ProtoBase/IPackageHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ProtoBase 7 | { 8 | /// 9 | /// Package handler interface 10 | /// 11 | /// The type of the package info. 12 | public interface IPackageHandler 13 | where TPackageInfo : IPackageInfo 14 | { 15 | /// 16 | /// Handles the specified received package. 17 | /// 18 | /// The received package. 19 | void Handle(TPackageInfo package); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /ProtoBase/IPackageInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ProtoBase 7 | { 8 | /// 9 | /// The basic package info interface 10 | /// 11 | public interface IPackageInfo 12 | { 13 | 14 | } 15 | 16 | /// 17 | /// The basic package info interface with key 18 | /// 19 | /// The type of the key. 20 | public interface IPackageInfo : IPackageInfo 21 | { 22 | /// 23 | /// Gets the key of the package info 24 | /// 25 | /// 26 | /// The key. 27 | /// 28 | TKey Key { get; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ProtoBase/IPackageResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ProtoBase 7 | { 8 | /// 9 | /// The package resolver interface 10 | /// 11 | /// The type of the package info. 12 | public interface IPackageResolver 13 | where TPackageInfo : IPackageInfo 14 | { 15 | /// 16 | /// Resolves the package binary data to package instance 17 | /// 18 | /// The received buffer stream. 19 | /// the resolved package instance 20 | TPackageInfo ResolvePackage(IBufferStream bufferStream); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ProtoBase/IPipelineProcessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ProtoBase 7 | { 8 | /// 9 | /// The pipeline data processor 10 | /// 11 | public interface IPipelineProcessor 12 | { 13 | /// 14 | /// Processes the input segment. 15 | /// 16 | /// The input segment. 17 | /// The buffer state. 18 | /// the processing result 19 | ProcessResult Process(ArraySegment segment, IBufferState state); 20 | 21 | /// 22 | /// Gets the received cache. 23 | /// 24 | /// 25 | /// The cache. 26 | /// 27 | BufferList Cache { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /ProtoBase/IProtoHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SuperSocket.ProtoBase 6 | { 7 | /// 8 | /// the protocol handler interface 9 | /// 10 | public interface IProtoHandler 11 | { 12 | /// 13 | /// Determines whether this instance can send. 14 | /// 15 | /// 16 | bool CanSend(); 17 | 18 | /// 19 | /// Gets the data encoder. 20 | /// 21 | /// 22 | /// The data encoder. 23 | /// 24 | IProtoDataEncoder DataEncoder { get; } 25 | 26 | 27 | /// 28 | /// Closes the specified channel. 29 | /// 30 | /// The channel. 31 | /// The reason. 32 | void Close(ICommunicationChannel channel, CloseReason reason); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /ProtoBase/IStringParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ProtoBase 7 | { 8 | /// 9 | /// the interface for the tools to parse string into key, body and parameters parts 10 | /// 11 | public interface IStringParser 12 | { 13 | /// 14 | /// parse the source string into key, body and parameters parts 15 | /// 16 | /// the source string 17 | /// the parsed key 18 | /// the parsed body 19 | /// the parsed parameter 20 | void Parse(string source, out string key, out string body, out string[] parameters); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ProtoBase/ProcessState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.ProtoBase 7 | { 8 | /// 9 | /// The processing state 10 | /// 11 | public enum ProcessState : byte 12 | { 13 | /// 14 | /// The being processed data was processed completely 15 | /// 16 | Completed, 17 | /// 18 | /// The being processed data was cached 19 | /// 20 | Cached, 21 | /// 22 | /// The processor is in error state 23 | /// 24 | Error 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ProtoBase/Properties/AssemblyInfo.Portable.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SuperSocket.ProtoBase for PCL")] 9 | [assembly: AssemblyDescription("SuperSocket.ProtoBase for Portable Class Library")] 10 | [assembly: AssemblyConfiguration("")] -------------------------------------------------------------------------------- /ProtoBase/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SuperSocket.ProtoBase")] 9 | [assembly: AssemblyDescription("SuperSocket.ProtoBase")] 10 | [assembly: AssemblyConfiguration("")] -------------------------------------------------------------------------------- /Protocols/Http/HttpHeaderKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SuperSocket.Http 8 | { 9 | public static class HttpHeaderKey 10 | { 11 | public const string Host = "Host"; 12 | 13 | public const string Connection = "Connection"; 14 | 15 | public const string ContentLength = "Content-Length"; 16 | 17 | public const string Accept = "Accept"; 18 | 19 | public const string Origin = "Origin"; 20 | 21 | public const string UserAgent = "User-Agent"; 22 | 23 | public const string ContentType = "Content-Type"; 24 | 25 | public const string Referer = "Referer"; 26 | 27 | public const string AcceptEncoding = "Accept-Encoding"; 28 | 29 | public const string Cookie = "Cookie"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Protocols/Http/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SuperSocket.Http")] 9 | [assembly: AssemblyDescription("SuperSocket.Http")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: ComVisible(false)] 12 | [assembly: Guid("c807bdeb-ab24-4696-86cc-a623ba3c360a")] 13 | -------------------------------------------------------------------------------- /Protocols/WebSocket.Test/Command/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using SuperSocket.ProtoBase; 7 | using SuperSocket.SocketBase; 8 | using SuperSocket.SocketBase.Command; 9 | using SuperSocket.SocketBase.Protocol; 10 | 11 | namespace SuperWebSocketTest.Command 12 | { 13 | public class ECHO : StringCommandBase 14 | { 15 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 16 | { 17 | var paramsArray = requestInfo.Body.Split(' '); 18 | for (var i = 0; i < paramsArray.Length; i++) 19 | { 20 | session.Send(paramsArray[i]); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Protocols/WebSocket.Test/Command/QUIT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.SocketBase.Command; 8 | using SuperSocket.SocketBase.Protocol; 9 | 10 | namespace SuperWebSocketTest.Command 11 | { 12 | public class QUIT : StringCommandBase 13 | { 14 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 15 | { 16 | session.Close(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Protocols/WebSocket.Test/Config/Basic.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Protocols/WebSocket.Test/WebSocketServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SuperSocket.SocketBase; 7 | 8 | namespace WebSocket.Test 9 | { 10 | public class WebSocketServer : AppServer 11 | { 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Protocols/WebSocket/Encoders/Hybi00ProtoDataEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.WebSocket.Encoders 9 | { 10 | class Hybi00ProtoDataEncoder : IProtoDataEncoder 11 | { 12 | private const string c_NotSupportErrorMessage = "The websocket of this version cannot used for sending binary data!"; 13 | 14 | public void EncodeData(IOutputBuffer output, IList> data) 15 | { 16 | throw new NotSupportedException(c_NotSupportErrorMessage); 17 | } 18 | 19 | public void EncodeData(IOutputBuffer output, ArraySegment data) 20 | { 21 | throw new NotSupportedException(c_NotSupportErrorMessage); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Protocols/WebSocket/Encoders/Hybi00ProtoTextEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.WebSocket.Encoders 9 | { 10 | class Hybi00ProtoTextEncoder : IProtoTextEncoder 11 | { 12 | public void EncodeText(IOutputBuffer output, string message) 13 | { 14 | var maxByteCount = Encoding.UTF8.GetMaxByteCount(message.Length) + 2; 15 | var sendBuffer = new byte[maxByteCount]; 16 | sendBuffer[0] = WebSocketConstant.StartByte; 17 | int bytesCount = Encoding.UTF8.GetBytes(message, 0, message.Length, sendBuffer, 1); 18 | sendBuffer[1 + bytesCount] = WebSocketConstant.EndByte; 19 | output.Add(new ArraySegment(sendBuffer, 0, bytesCount + 2)); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Protocols/WebSocket/Encoders/Rfc6455ProtoTextEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.WebSocket.Encoders 9 | { 10 | class Rfc6455ProtoTextEncoder : Rfc6455ProtoDataEncoder, IProtoTextEncoder 11 | { 12 | private readonly static Encoding s_Encoding = new UTF8Encoding(); 13 | 14 | public IList> EncodeText(string message) 15 | { 16 | return new ArraySegment[] 17 | { 18 | EncodeData(OpCode.Binary, true, new ArraySegment(s_Encoding.GetBytes(message))) 19 | }; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Protocols/WebSocket/IBinaryDataConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.WebSocket 7 | { 8 | /// 9 | /// The converter interface for converting binary data to text message 10 | /// 11 | public interface IBinaryDataConverter 12 | { 13 | /// 14 | /// Returns a that represents this instance. 15 | /// 16 | /// The data. 17 | /// The offset. 18 | /// The length. 19 | /// 20 | /// A that represents this instance. 21 | /// 22 | string ToString(byte[] data, int offset, int length); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Protocols/WebSocket/IBinaryDataParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SuperSocket.WebSocket 8 | { 9 | /// 10 | /// The basic interface for binary data parser 11 | /// 12 | public interface IBinaryDataParser 13 | { 14 | /// 15 | /// Parses the specified data source. 16 | /// 17 | /// The data source. 18 | /// 19 | KeyValuePair Parse(IList> dataSource); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Protocols/WebSocket/IHandshakeValidator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.WebSocket 9 | { 10 | public interface IHandshakeValidator 11 | { 12 | bool ValidateHandshake(ICommunicationChannel channel, HttpHeaderInfo handshakeRequest); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Protocols/WebSocket/OpCode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.WebSocket 7 | { 8 | public enum OpCode : sbyte 9 | { 10 | Continuation = 0, 11 | 12 | Text = 1, 13 | 14 | Binary = 2, 15 | 16 | Close = 8, 17 | 18 | Ping = 9, 19 | 20 | Pong = 10 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Protocols/WebSocket/OpHandlers/BinaryHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SuperSocket.SocketBase; 4 | 5 | namespace SuperSocket.WebSocket.OpHandlers 6 | { 7 | class BinaryHandler : OpHandlerBase 8 | { 9 | public BinaryHandler(WebSocketServiceProvider serviceProvider) 10 | : base(serviceProvider) 11 | { 12 | 13 | } 14 | 15 | public override sbyte OpCode 16 | { 17 | get { return SuperSocket.WebSocket.OpCode.Binary; } 18 | } 19 | 20 | public override WebSocketPackageInfo Handle(IAppSession session, WebSocketContext context, IList> data) 21 | { 22 | return new WebSocketPackageInfo(data, ServiceProvider.BinaryDataParser, ServiceProvider.StringParser); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Protocols/WebSocket/OpHandlers/CloseHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace SuperSocket.WebSocket.OpHandlers 5 | { 6 | class CloseHandler : OpHandlerBase 7 | { 8 | public CloseHandler(WebSocketServiceProvider serviceProvider) 9 | : base(serviceProvider) 10 | { 11 | 12 | } 13 | 14 | public override sbyte OpCode 15 | { 16 | get { return SuperSocket.WebSocket.OpCode.Close; } 17 | } 18 | 19 | public override WebSocketPackageInfo Handle(IAppSession session, WebSocketContext context, IList> data) 20 | { 21 | throw new NotImplementedException(); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Protocols/WebSocket/OpHandlers/IOpHandler.cs: -------------------------------------------------------------------------------- 1 | using SuperSocket.SocketBase; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace SuperSocket.WebSocket.OpHandlers 9 | { 10 | interface IOpHandler 11 | { 12 | sbyte OpCode { get; } 13 | 14 | WebSocketPackageInfo Handle(IAppSession session, WebSocketContext context, IList> data); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Protocols/WebSocket/OpHandlers/OpHandlerBase.cs: -------------------------------------------------------------------------------- 1 | using SuperSocket.SocketBase; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace SuperSocket.WebSocket.OpHandlers 9 | { 10 | abstract class OpHandlerBase : IOpHandler 11 | { 12 | protected OpHandlerBase(WebSocketServiceProvider serviceProvider) 13 | { 14 | ServiceProvider = serviceProvider; 15 | } 16 | 17 | protected WebSocketServiceProvider ServiceProvider { get; private set; } 18 | 19 | public abstract sbyte OpCode { get; } 20 | 21 | public abstract WebSocketPackageInfo Handle(IAppSession session, WebSocketContext context, IList> data); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Protocols/WebSocket/OpHandlers/PingHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SuperSocket.SocketBase; 4 | 5 | namespace SuperSocket.WebSocket.OpHandlers 6 | { 7 | class PingHandler : OpHandlerBase 8 | { 9 | public PingHandler(WebSocketServiceProvider serviceProvider) 10 | : base(serviceProvider) 11 | { 12 | 13 | } 14 | 15 | public override sbyte OpCode 16 | { 17 | get { return SuperSocket.WebSocket.OpCode.Ping; } 18 | } 19 | 20 | public override WebSocketPackageInfo Handle(IAppSession session, WebSocketContext context, IList> data) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Protocols/WebSocket/OpHandlers/PongHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SuperSocket.SocketBase; 4 | 5 | namespace SuperSocket.WebSocket.OpHandlers 6 | { 7 | class PongHandler : OpHandlerBase 8 | { 9 | public PongHandler(WebSocketServiceProvider serviceProvider) 10 | : base(serviceProvider) 11 | { 12 | 13 | } 14 | 15 | public override sbyte OpCode 16 | { 17 | get { return SuperSocket.WebSocket.OpCode.Pong; } 18 | } 19 | 20 | public override WebSocketPackageInfo Handle(IAppSession session, WebSocketContext context, IList> data) 21 | { 22 | throw new NotImplementedException(); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Protocols/WebSocket/Properties/AssemblyInfo.Portable.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("SuperSocket.WebSocket")] 6 | [assembly: AssemblyDescription("SuperSocket.WebSocket")] -------------------------------------------------------------------------------- /Protocols/WebSocket/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("SuperSocket.WebSocket")] 6 | [assembly: AssemblyDescription("SuperSocket.WebSocket")] 7 | [assembly: ComVisible(false)] 8 | [assembly: Guid("0b046c54-9dc3-419c-afd2-4ef7671ff935")] -------------------------------------------------------------------------------- /Protocols/WebSocket/Protocol/FramePartReader/IDataFramePartReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.WebSocket.Protocol.FramePartReader 7 | { 8 | interface IDataFramePartReader 9 | { 10 | int Process(int lastLength, WebSocketDataFrame frame, out IDataFramePartReader nextPartReader); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Protocols/WebSocket/Protocol/FramePartReader/PayloadDataReader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.WebSocket.Protocol.FramePartReader 7 | { 8 | class PayloadDataReader : DataFramePartReader 9 | { 10 | public override int Process(int lastLength, WebSocketDataFrame frame, out IDataFramePartReader nextPartReader) 11 | { 12 | long required = lastLength + frame.ActualPayloadLength; 13 | 14 | if (frame.Length < required) 15 | { 16 | nextPartReader = this; 17 | return -1; 18 | } 19 | 20 | nextPartReader = null; 21 | 22 | return (int)((long)frame.Length - required); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Protocols/WebSocket/Protocol/HandshakeRequest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.WebSocket.Protocol 7 | { 8 | /// 9 | /// Handshake request 10 | /// 11 | class HandshakeRequest : IWebSocketFragment 12 | { 13 | /// 14 | /// Gets the key of this request. 15 | /// 16 | public string Key 17 | { 18 | get { return OpCode.HandshakeTag; } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Protocols/WebSocket/Protocol/IWebSocketFragment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.Common; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.SocketBase.Protocol; 8 | 9 | namespace SuperSocket.WebSocket.Protocol 10 | { 11 | /// 12 | /// WebSocketFragment request info 13 | /// 14 | public interface IWebSocketFragment : IRequestInfo 15 | { 16 | 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Protocols/WebSocket/ReceiveFilters/IHandshakeHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.WebSocket.ReceiveFilters 7 | { 8 | interface IHandshakeHandler 9 | { 10 | bool Handshake(WebSocketContext context); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Protocols/WebSocket/ReceiveFilters/IWebSocketReceiveFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.WebSocket.ReceiveFilters 9 | { 10 | interface IWebSocketReceiveFilter : IReceiveFilter, IHandshakeHandler 11 | { 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Protocols/WebSocket/ReceiveFilters/Rfc6455ReceiveFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.WebSocket.ReceiveFilters 7 | { 8 | class Rfc6455ReceiveFilter : DraftHybi10ReceiveFilter, IHandshakeHandler 9 | { 10 | public Rfc6455ReceiveFilter() 11 | : base() 12 | { 13 | 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Protocols/WebSocket/SubProtocol/ISubCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.SocketBase.Protocol; 8 | 9 | namespace SuperSocket.WebSocket.SubProtocol 10 | { 11 | /// 12 | /// SubCommand interface 13 | /// 14 | /// The type of the web socket session. 15 | public interface ISubCommand : ICommand 16 | where TWebSocketSession : WebSocketSession, new() 17 | { 18 | /// 19 | /// Executes the command. 20 | /// 21 | /// The session. 22 | /// The request info. 23 | void ExecuteCommand(TWebSocketSession session, SubRequestInfo requestInfo); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Protocols/WebSocket/SubProtocol/ISubCommandFilterLoader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SuperSocket.WebSocket.SubProtocol 8 | { 9 | /// 10 | /// The basic interface of sub command filter loader 11 | /// 12 | public interface ISubCommandFilterLoader 13 | { 14 | /// 15 | /// Loads the sub command filters. 16 | /// 17 | /// The global filters. 18 | void LoadSubCommandFilters(IEnumerable globalFilters); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Protocols/WebSocket/SubProtocol/ISubRequestInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SuperSocket.SocketBase.Protocol; 7 | 8 | namespace SuperSocket.WebSocket.SubProtocol 9 | { 10 | /// 11 | /// The basic interface of SubRequestInfo 12 | /// 13 | public interface ISubRequestInfo : IRequestInfo 14 | { 15 | /// 16 | /// Gets the token. 17 | /// 18 | /// 19 | /// The token. 20 | /// 21 | string Token { get; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Protocols/WebSocket/SubProtocol/SubCommandFilterAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.SocketBase.Metadata; 8 | 9 | namespace SuperSocket.WebSocket.SubProtocol 10 | { 11 | /// 12 | /// SubCommandFilter Attribute 13 | /// 14 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] 15 | public abstract class SubCommandFilterAttribute : CommandFilterAttribute 16 | { 17 | /// 18 | /// Gets or sets the sub protocol. 19 | /// 20 | /// 21 | /// The sub protocol. 22 | /// 23 | public string SubProtocol { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Protocols/WebSocket/packages.SuperSocket.WebSocket.Net40.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Protocols/WebSocket/packages.SuperSocket.WebSocket.Net45.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleA/Command/CLOSE.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.AppDomainIsolation.SampleA.Command 10 | { 11 | public class CLOSE : StringCommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Close(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleA/Command/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.AppDomainIsolation.SampleA.Command 10 | { 11 | public class ECHO : StringCommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Body); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleA/SampleServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.AppDomainIsolation.SampleA 8 | { 9 | public class SampleServer : AppServer 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleB/Command/CLOSE.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.AppDomainIsolation.SampleB.Command 10 | { 11 | public class CLOSE : StringCommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Close(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleB/Command/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.AppDomainIsolation.SampleB.Command 10 | { 11 | public class ECHO : StringCommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Body); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleB/SampleServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.AppDomainIsolation.SampleB 8 | { 9 | public class SampleServer : AppServer 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleC/InstancesRoot/ServerA/Command/ADD.py: -------------------------------------------------------------------------------- 1 | def execute(session, request): 2 | session.Send(str(int(request[0]) + int(request[1]))) -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleC/InstancesRoot/ServerA/Command/QUIT.py: -------------------------------------------------------------------------------- 1 | def execute(session, request): 2 | session.Close() -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleC/InstancesRoot/ServerB/Command/MULT.py: -------------------------------------------------------------------------------- 1 | def execute(session, request): 2 | session.Send(str(int(request[0]) * int(request[1]))) -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleC/InstancesRoot/ServerB/Command/QUIT.py: -------------------------------------------------------------------------------- 1 | def execute(session, request): 2 | session.Close() -------------------------------------------------------------------------------- /QuickStart/AppDomainIsolation/SampleC/SampleServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.AppDomainIsolation.SampleC 8 | { 9 | public class SampleServer : AppServer 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppServer/ADD.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_AppServer 10 | { 11 | public class ADD : CommandBase 12 | { 13 | public override void ExecuteCommand(TelnetSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Parameters.Select(p => Convert.ToInt32(p)).Sum().ToString()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppServer/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_AppServer 10 | { 11 | public class ECHO : CommandBase 12 | { 13 | public override void ExecuteCommand(TelnetSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Body); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppServer/MULT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_AppServer 10 | { 11 | public class MULT : CommandBase 12 | { 13 | public override void ExecuteCommand(TelnetSession session, StringPackageInfo requestInfo) 14 | { 15 | var result = 1; 16 | 17 | foreach (var factor in requestInfo.Parameters.Select(p => Convert.ToInt32(p))) 18 | { 19 | result *= factor; 20 | } 21 | 22 | session.Send(result.ToString()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppServer/TelnetServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Config; 7 | 8 | namespace SuperSocket.QuickStart.TelnetServer_AppServer 9 | { 10 | public class TelnetServer : AppServer 11 | { 12 | protected override bool Setup(IRootConfig rootConfig, IServerConfig config) 13 | { 14 | return base.Setup(rootConfig, config); 15 | } 16 | 17 | protected override void OnStarted() 18 | { 19 | base.OnStarted(); 20 | } 21 | 22 | protected override void OnStopped() 23 | { 24 | base.OnStopped(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppServer/TelnetSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.QuickStart.TelnetServer_AppServer 9 | { 10 | public class TelnetSession : AppSession 11 | { 12 | protected override void OnSessionStarted() 13 | { 14 | this.Send("Welcome to SuperSocket Telnet Server"); 15 | } 16 | 17 | protected override void HandleUnknownRequest(StringPackageInfo requestInfo) 18 | { 19 | this.Send("Unknow request"); 20 | } 21 | 22 | protected override void HandleException(Exception e) 23 | { 24 | this.Send("Application error: {0}", e.Message); 25 | } 26 | 27 | protected override void OnSessionClosed(CloseReason reason) 28 | { 29 | base.OnSessionClosed(reason); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppServer/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppServer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppSession/ADD.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_AppSession 10 | { 11 | public class ADD : CommandBase 12 | { 13 | public override void ExecuteCommand(TelnetSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Parameters.Select(p => Convert.ToInt32(p)).Sum().ToString()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppSession/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_AppSession 10 | { 11 | public class ECHO : CommandBase 12 | { 13 | public override void ExecuteCommand(TelnetSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Body); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppSession/MULT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_AppSession 10 | { 11 | public class MULT : CommandBase 12 | { 13 | public override void ExecuteCommand(TelnetSession session, StringPackageInfo requestInfo) 14 | { 15 | var result = 1; 16 | 17 | foreach (var factor in requestInfo.Parameters.Select(p => Convert.ToInt32(p))) 18 | { 19 | result *= factor; 20 | } 21 | 22 | session.Send(result.ToString()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppSession/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_AppSession/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_Command/ADD.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_Command 10 | { 11 | public class ADD : CommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Parameters.Select(p => Convert.ToInt32(p)).Sum().ToString()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_Command/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_Command 10 | { 11 | public class ECHO : CommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Body); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_Command/MULT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_Command 10 | { 11 | public class MULT : CommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | var result = 1; 16 | 17 | foreach (var factor in requestInfo.Parameters.Select(p => Convert.ToInt32(p))) 18 | { 19 | result *= factor; 20 | } 21 | 22 | session.Send(result.ToString()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_Command/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_Command/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_ProcessRequest/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_ProcessRequest/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_StartByConfig/ADD.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_StartByConfig 10 | { 11 | public class ADD : CommandBase 12 | { 13 | public override void ExecuteCommand(TelnetSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Parameters.Select(p => Convert.ToInt32(p)).Sum().ToString()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_StartByConfig/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_StartByConfig/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_StartByConfig 10 | { 11 | public class ECHO : CommandBase 12 | { 13 | public override void ExecuteCommand(TelnetSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Body); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_StartByConfig/MULT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TelnetServer_StartByConfig 10 | { 11 | public class MULT : CommandBase 12 | { 13 | public override void ExecuteCommand(TelnetSession session, StringPackageInfo requestInfo) 14 | { 15 | var result = 1; 16 | 17 | foreach (var factor in requestInfo.Parameters.Select(p => Convert.ToInt32(p))) 18 | { 19 | result *= factor; 20 | } 21 | 22 | session.Send(result.ToString()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_StartByConfig/TelnetServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Config; 7 | 8 | namespace SuperSocket.QuickStart.TelnetServer_StartByConfig 9 | { 10 | public class TelnetServer : AppServer 11 | { 12 | protected override bool Setup(IRootConfig rootConfig, IServerConfig config) 13 | { 14 | return base.Setup(rootConfig, config); 15 | } 16 | 17 | protected override void OnStarted() 18 | { 19 | base.OnStarted(); 20 | } 21 | 22 | protected override void OnStopped() 23 | { 24 | base.OnStopped(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /QuickStart/Basic/TelnetServer_StartByConfig/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/BroadcastService/BroadcastSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.BroadcastService 8 | { 9 | public class BroadcastSession : AppSession 10 | { 11 | public string DeviceNumber { get; set; } 12 | 13 | public new BroadcastServer AppServer 14 | { 15 | get { return (BroadcastServer)base.AppServer; } 16 | } 17 | 18 | protected override void HandleException(Exception e) 19 | { 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /QuickStart/BroadcastService/Command/BROA.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.QuickStart.BroadcastService.Command 9 | { 10 | public class BROA : StringCommandBase 11 | { 12 | public override void ExecuteCommand(BroadcastSession session, StringPackageInfo requestInfo) 13 | { 14 | string message = requestInfo.Body; 15 | session.AppServer.BroadcastMessage(session, message); 16 | session.Send("101 message broadcasted"); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /QuickStart/BroadcastService/Command/CONN.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.QuickStart.BroadcastService.Command 9 | { 10 | public class CONN : StringCommandBase 11 | { 12 | public override void ExecuteCommand(BroadcastSession session, StringPackageInfo requestInfo) 13 | { 14 | session.DeviceNumber = requestInfo[0]; 15 | session.AppServer.RegisterNewSession(session); 16 | session.Send("100 Connected"); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /QuickStart/CommandFilter/CountCommandFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.SocketBase.Command; 8 | using SuperSocket.SocketBase.Metadata; 9 | 10 | namespace SuperSocket.QuickStart.CommandFilter 11 | { 12 | public class CountCommandFilter : CommandFilterAttribute 13 | { 14 | private long m_Total = 0; 15 | 16 | public override void OnCommandExecuting(ICommandExecutingContext commandContext) 17 | { 18 | 19 | } 20 | 21 | public override void OnCommandExecuted(ICommandExecutingContext commandContext) 22 | { 23 | Interlocked.Increment(ref m_Total); 24 | } 25 | 26 | public long Total 27 | { 28 | get { return m_Total; } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /QuickStart/CommandFilter/LOGIN.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.QuickStart.CommandFilter 9 | { 10 | [LogTimeCommandFilter] 11 | public class LOGIN : StringCommandBase 12 | { 13 | public override void ExecuteCommand(MyAppSession session, StringPackageInfo requestInfo) 14 | { 15 | if (requestInfo.Parameters == null || requestInfo.Parameters.Length != 2) 16 | return; 17 | 18 | var username = requestInfo.Parameters[0]; 19 | var password = requestInfo.Parameters[1]; 20 | 21 | if("kerry".Equals(username) && "123456".Equals(password)) 22 | { 23 | session.IsLoggedIn = true; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /QuickStart/CommandFilter/LoggedInValidationFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Metadata; 7 | 8 | namespace SuperSocket.QuickStart.CommandFilter 9 | { 10 | public class LoggedInValidationFilter : CommandFilterAttribute 11 | { 12 | public override void OnCommandExecuting(ICommandExecutingContext commandContext) 13 | { 14 | var session = commandContext.Session as MyAppSession; 15 | 16 | //If the session is not logged in, cancel the executing of the command 17 | if (!session.IsLoggedIn) 18 | commandContext.Cancel = true; 19 | } 20 | 21 | public override void OnCommandExecuted(ICommandExecutingContext commandContext) 22 | { 23 | 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /QuickStart/CommandFilter/MyAppServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.CommandFilter 8 | { 9 | [CountCommandFilter]//Global command filter 10 | public class MyAppServer : AppServer 11 | { 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /QuickStart/CommandFilter/MyAppSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.CommandFilter 8 | { 9 | public class MyAppSession : AppSession 10 | { 11 | public bool IsLoggedIn { internal set; get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /QuickStart/CommandFilter/QUERY.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.CommandFilter 10 | { 11 | [LoggedInValidationFilter(Order = 0)] 12 | [LogTimeCommandFilter(Order = 1)] 13 | public class QUERY : StringCommandBase 14 | { 15 | public override void ExecuteCommand(MyAppSession session, StringPackageInfo requestInfo) 16 | { 17 | //Your code 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /QuickStart/CommandFilter/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/CountSpliterProtocol/Command/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.CountSpliterProtocol.Command 10 | { 11 | public class ECHO : CommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | for (var i = 0; i < requestInfo.Parameters.Length; i++) 16 | { 17 | session.Send(requestInfo.Parameters[i]); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /QuickStart/CountSpliterProtocol/CountSpliterAppServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | using SuperSocket.SocketBase; 4 | using SuperSocket.SocketBase.Protocol; 5 | 6 | namespace SuperSocket.QuickStart.CountSpliterProtocol 7 | { 8 | /// 9 | /// Your protocol likes like the format below: 10 | /// #part1#part2#part3#part4#part5#part6#part7# 11 | /// 12 | public class CountSpliterAppServer : AppServer 13 | { 14 | public CountSpliterAppServer() 15 | : base(new CountSpliterReceiveFilterFactory((byte)'#', 8)) 16 | { 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /QuickStart/CustomProtocol/Command/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.QuickStart.CustomProtocol.Command 9 | { 10 | public class ECHO : CommandBase 11 | { 12 | public override void ExecuteCommand(CustomProtocolSession session, BufferedPackageInfo requestInfo) 13 | { 14 | session.Send(requestInfo.Data); 15 | session.Send(new ArraySegment(session.Charset.GetBytes(Environment.NewLine))); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/CustomProtocol/CustomProtocolSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.SocketBase.Command; 8 | using SuperSocket.ProtoBase; 9 | 10 | namespace SuperSocket.QuickStart.CustomProtocol 11 | { 12 | public class CustomProtocolSession : AppSession 13 | { 14 | protected override void HandleException(Exception e) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /QuickStart/CustomProtocol/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/CustomRequestInfoParser/Command/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.QuickStart.CustomCommandParser.Command 9 | { 10 | public class ECHO : StringCommandBase 11 | { 12 | public override void ExecuteCommand(YourSession session, StringPackageInfo requestInfo) 13 | { 14 | foreach (var p in requestInfo.Parameters) 15 | { 16 | session.Send(p); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /QuickStart/CustomRequestInfoParser/YourServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Protocol; 7 | 8 | namespace SuperSocket.QuickStart.CustomCommandParser 9 | { 10 | public class YourServer : AppServer 11 | { 12 | public YourServer() 13 | : base(new CommandLineReceiveFilterFactory(Encoding.Default, new CustomStringParser())) 14 | { 15 | 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/CustomRequestInfoParser/YourSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.CustomCommandParser 8 | { 9 | public class YourSession : AppSession 10 | { 11 | protected override void OnSessionStarted() 12 | { 13 | Send("Welcome"); 14 | } 15 | 16 | protected override void HandleException(Exception e) 17 | { 18 | 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /QuickStart/CustomRequestInfoParser/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/GPSSocketServer/Command/BinaryPackageInfo.cs: -------------------------------------------------------------------------------- 1 | namespace SuperSocket.QuickStart.GPSSocketServer.Command 2 | { 3 | public class BinaryPackageInfo 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /QuickStart/GPSSocketServer/Command/KeepAlive.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | 9 | namespace SuperSocket.QuickStart.GPSSocketServer.Command 10 | { 11 | public class KeepAlive : CommandBase 12 | { 13 | public override string Name 14 | { 15 | get 16 | { 17 | return "10"; 18 | } 19 | } 20 | 21 | public override void ExecuteCommand(GPSSession session, BufferedPackageInfo requestInfo) 22 | { 23 | //You can do nothing, after this command is executed, the LastActiveTime of this session will be updated 24 | var response = session.AppServer.DefaultResponse; 25 | session.Send(response, 0, response.Length); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /QuickStart/GPSSocketServer/Command/Position.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.QuickStart.GPSSocketServer.Command 9 | { 10 | public class Position : CommandBase 11 | { 12 | public override string Name 13 | { 14 | get 15 | { 16 | return "1A"; 17 | } 18 | } 19 | 20 | public override void ExecuteCommand(GPSSession session, BufferedPackageInfo requestInfo) 21 | { 22 | //The logic of saving GPS position data 23 | var response = session.AppServer.DefaultResponse; 24 | session.Send(response, 0, response.Length); ; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /QuickStart/GPSSocketServer/GPSServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.SocketBase.Command; 8 | using SuperSocket.SocketBase.Protocol; 9 | 10 | namespace SuperSocket.QuickStart.GPSSocketServer 11 | { 12 | public class GPSServer : AppServer 13 | { 14 | public GPSServer() 15 | : base(new DefaultReceiveFilterFactory()) 16 | { 17 | DefaultResponse = new byte[] { 0x54, 0x68, 0x1a, 0x0d, 0x0a}; 18 | } 19 | 20 | internal byte[] DefaultResponse { get; private set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QuickStart/GPSSocketServer/GPSSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase; 7 | 8 | namespace SuperSocket.QuickStart.GPSSocketServer 9 | { 10 | public class GPSSession : AppSession 11 | { 12 | public new GPSServer AppServer 13 | { 14 | get 15 | { 16 | return (GPSServer)base.AppServer; 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /QuickStart/GPSSocketServer/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/IronSocketServer/Command/IronPythonServer/ADD.py: -------------------------------------------------------------------------------- 1 | def execute(session, request): 2 | session.Send(str(int(request[0]) + int(request[1]))) -------------------------------------------------------------------------------- /QuickStart/IronSocketServer/Command/IronPythonServer/MULT.py: -------------------------------------------------------------------------------- 1 | def execute(session, request): 2 | session.Send(str(int(request[0]) * int(request[1]))) -------------------------------------------------------------------------------- /QuickStart/IronSocketServer/Command/QUIT.py: -------------------------------------------------------------------------------- 1 | def execute(session, request): 2 | session.Close() -------------------------------------------------------------------------------- /QuickStart/IronSocketServer/DynamicAppServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.IronSocketServer 8 | { 9 | public class DynamicAppServer : AppServer 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /QuickStart/MultipleAppServer/DESP.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.MultipleAppServer 10 | { 11 | public class DESP : StringCommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | ((MyAppServerA)session.AppServer).DespatchMessage(requestInfo[0], requestInfo[1]); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/MultipleAppServer/IDespatchServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.QuickStart.MultipleAppServer 7 | { 8 | interface IDespatchServer 9 | { 10 | void DispatchMessage(string sessionKey, string message); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /QuickStart/MultipleAppServer/MyAppServerA.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketEngine; 7 | 8 | namespace SuperSocket.QuickStart.MultipleAppServer 9 | { 10 | public class MyAppServerA : AppServer 11 | { 12 | private IDespatchServer m_DespatchServer; 13 | 14 | protected override void OnStarted() 15 | { 16 | m_DespatchServer = this.Bootstrap.GetServerByName("ServerB") as IDespatchServer; 17 | base.OnStarted(); 18 | } 19 | 20 | internal void DespatchMessage(string targetSessionKey, string message) 21 | { 22 | m_DespatchServer.DispatchMessage(targetSessionKey, message); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /QuickStart/MultipleAppServer/MyAppServerB.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.MultipleAppServer 8 | { 9 | public class MyAppServerB : AppServer, IDespatchServer 10 | { 11 | public void DispatchMessage(string sessionKey, string message) 12 | { 13 | var session = GetSessionByID(sessionKey); 14 | if (session == null) 15 | return; 16 | 17 | session.Send(message); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /QuickStart/MultipleCommandAssembly/CommandAssemblyA/ADD.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.SocketBase.Command; 8 | 9 | namespace SuperSocket.QuickStart.SampleServer.CommandAssemblyA 10 | { 11 | public class ADD : StringCommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Parameters.Select(p => Convert.ToInt32(p)).Sum().ToString()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/MultipleCommandAssembly/CommandAssemblyB/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.SocketBase.Command; 8 | using SuperSocket.ProtoBase; 9 | 10 | namespace SuperSocket.QuickStart.SampleServer.CommandAssemblyB 11 | { 12 | public class ECHO : StringCommandBase 13 | { 14 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 15 | { 16 | session.Send(requestInfo.Body); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /QuickStart/MultipleCommandAssembly/CommandAssemblyC/MULT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.SocketBase.Command; 8 | 9 | namespace SuperSocket.QuickStart.SampleServer.CommandAssemblyC 10 | { 11 | public class MULT : StringCommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | var result = 1; 16 | 17 | foreach (var factor in requestInfo.Parameters.Select(p => Convert.ToInt32(p))) 18 | { 19 | result *= factor; 20 | } 21 | 22 | session.Send(result.ToString()); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /QuickStart/MultipleCommandAssembly/SampleServer/SampleAppServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.SampleServer 8 | { 9 | public class SampleAppServer : AppServer 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /QuickStart/RemoteProcessService/Command/QUIT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.QuickStart.RemoteProcessService.Command 9 | { 10 | public class QUIT : StringCommandBase 11 | { 12 | #region CommandBase Members 13 | 14 | public override void ExecuteCommand(RemoteProcessSession session, StringPackageInfo requestInfo) 15 | { 16 | session.Send("bye"); 17 | session.Close(); 18 | } 19 | 20 | #endregion 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /QuickStart/RemoteProcessService/RemoteProcessSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.RemoteProcessService 8 | { 9 | public class RemoteProcessSession : AppSession 10 | { 11 | public new RemoteProcessServer AppServer 12 | { 13 | get { return (RemoteProcessServer)base.AppServer; } 14 | } 15 | 16 | protected override void OnSessionStarted() 17 | { 18 | Send("Welcome to use this tool!"); 19 | } 20 | 21 | protected override void HandleException(Exception e) 22 | { 23 | Send("An error has occurred in server side! Error message: " + e.Message + "!"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /QuickStart/RemoteProcessService/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/ServerManagerSample/Config/Silverlight.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /QuickStart/ServerManagerSample/SampleServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.QuickStart.ServerManagerSample 8 | { 9 | public class SampleServer : AppServer 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /QuickStart/ServerPush/SuperSocket.SocketService.exe.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /QuickStart/ServerPush/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/SwitchReceiveFilter/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.SwitchReceiveFilter 10 | { 11 | public class ECHO : StringCommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Body); 16 | Console.WriteLine("S:" + requestInfo.Body); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /QuickStart/SwitchReceiveFilter/MyAppServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.ProtoBase; 7 | using SuperSocket.SocketBase.Protocol; 8 | 9 | namespace SuperSocket.QuickStart.SwitchReceiveFilter 10 | { 11 | public class MyAppServer : AppServer 12 | { 13 | public MyAppServer() 14 | : base(new DefaultReceiveFilterFactory()) 15 | { 16 | 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /QuickStart/SwitchReceiveFilter/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /QuickStart/TerminatorProtocol/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.QuickStart.TerminatorProtocol 10 | { 11 | public class ECHO : StringCommandBase 12 | { 13 | public override void ExecuteCommand(AppSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(requestInfo.Body); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /QuickStart/TerminatorProtocol/TerminatorProtocolServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | using SuperSocket.SocketBase.Protocol; 7 | 8 | namespace SuperSocket.QuickStart.TerminatorProtocol 9 | { 10 | /// 11 | /// TerminatorProtocolServer 12 | /// Each request end with the terminator "##" 13 | /// ECHO Your message## 14 | /// 15 | public class TerminatorProtocolServer : AppServer 16 | { 17 | public TerminatorProtocolServer() 18 | : base(new TerminatorReceiveFilterFactory("##")) 19 | { 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /QuickStart/WindowsAzure/AzureHost/ServiceConfiguration.cscfg: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /QuickStart/WindowsAzure/AzureHost/ServiceDefinition.csdef: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Reference/Blend/net40/Microsoft.Expression.Interactions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Blend/net40/Microsoft.Expression.Interactions.dll -------------------------------------------------------------------------------- /Reference/Blend/net40/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Blend/net40/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Reference/Blend/sl40/Microsoft.Expression.Interactions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Blend/sl40/Microsoft.Expression.Interactions.dll -------------------------------------------------------------------------------- /Reference/Blend/sl40/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Blend/sl40/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Reference/Blend/sl50/Microsoft.Expression.Interactions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Blend/sl50/Microsoft.Expression.Interactions.dll -------------------------------------------------------------------------------- /Reference/Blend/sl50/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Blend/sl50/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Reference/Blend/wp71/Microsoft.Expression.Interactions.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Blend/wp71/Microsoft.Expression.Interactions.dll -------------------------------------------------------------------------------- /Reference/Blend/wp71/System.Windows.Interactivity.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Blend/wp71/System.Windows.Interactivity.dll -------------------------------------------------------------------------------- /Reference/DLR/Net35/Microsoft.Dynamic.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/DLR/Net35/Microsoft.Dynamic.dll -------------------------------------------------------------------------------- /Reference/DLR/Net35/Microsoft.Scripting.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/DLR/Net35/Microsoft.Scripting.Core.dll -------------------------------------------------------------------------------- /Reference/DLR/Net35/Microsoft.Scripting.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/DLR/Net35/Microsoft.Scripting.dll -------------------------------------------------------------------------------- /Reference/DLR/Net40/Microsoft.Dynamic.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/DLR/Net40/Microsoft.Dynamic.dll -------------------------------------------------------------------------------- /Reference/DLR/Net40/Microsoft.Scripting.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/DLR/Net40/Microsoft.Scripting.dll -------------------------------------------------------------------------------- /Reference/DynamicViewModel/Net40/DynamicViewModel.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/DynamicViewModel/Net40/DynamicViewModel.dll -------------------------------------------------------------------------------- /Reference/DynamicViewModel/Net40/DynamicViewModel.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/DynamicViewModel/Net40/DynamicViewModel.pdb -------------------------------------------------------------------------------- /Reference/DynamicViewModel/SL/DynamicViewModel.SL.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/DynamicViewModel/SL/DynamicViewModel.SL.dll -------------------------------------------------------------------------------- /Reference/DynamicViewModel/SL/DynamicViewModel.SL.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/DynamicViewModel/SL/DynamicViewModel.SL.pdb -------------------------------------------------------------------------------- /Reference/IronPython/Net35/IronPython.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/IronPython/Net35/IronPython.dll -------------------------------------------------------------------------------- /Reference/IronPython/Net40/IronPython.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/IronPython/Net40/IronPython.dll -------------------------------------------------------------------------------- /Reference/Json.NET/Net35/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Json.NET/Net35/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Reference/Json.NET/Net40/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Json.NET/Net40/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Reference/Json.NET/Portable/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Json.NET/Portable/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Reference/Json.NET/Portable/Newtonsoft.Json.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/Json.NET/Portable/Newtonsoft.Json.pdb -------------------------------------------------------------------------------- /Reference/SilverlightToolkit/40/System.Windows.Controls.Input.Toolkit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/SilverlightToolkit/40/System.Windows.Controls.Input.Toolkit.dll -------------------------------------------------------------------------------- /Reference/SilverlightToolkit/40/System.Windows.Controls.Toolkit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/SilverlightToolkit/40/System.Windows.Controls.Toolkit.dll -------------------------------------------------------------------------------- /Reference/SilverlightToolkit/50/System.Windows.Controls.Data.Toolkit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/SilverlightToolkit/50/System.Windows.Controls.Data.Toolkit.dll -------------------------------------------------------------------------------- /Reference/SilverlightToolkit/50/System.Windows.Controls.Input.Toolkit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/SilverlightToolkit/50/System.Windows.Controls.Input.Toolkit.dll -------------------------------------------------------------------------------- /Reference/SilverlightToolkit/50/System.Windows.Controls.Toolkit.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/SilverlightToolkit/50/System.Windows.Controls.Toolkit.dll -------------------------------------------------------------------------------- /Reference/System.Threading.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/System.Threading.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/monodroid22/Debug/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/monodroid22/Debug/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/monodroid22/Debug/WebSocket4Net.dll.mdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/monodroid22/Debug/WebSocket4Net.dll.mdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/monodroid22/Debug/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/monodroid22/Debug/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/monodroid22/Release/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/monodroid22/Release/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/monodroid22/Release/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/monodroid22/Release/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net20/Debug/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net20/Debug/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net20/Debug/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net20/Debug/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net20/Release/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net20/Release/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net20/Release/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net20/Release/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net35/Debug/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net35/Debug/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net35/Debug/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net35/Debug/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net35/Release/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net35/Release/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net35/Release/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net35/Release/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net40/Debug/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net40/Debug/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net40/Debug/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net40/Debug/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net40/Release/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net40/Release/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net40/Release/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net40/Release/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net45/Debug/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net45/Debug/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net45/Debug/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net45/Debug/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net45/Release/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net45/Release/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/net45/Release/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/net45/Release/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl40-windowsphone71/Debug/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl40-windowsphone71/Debug/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl40-windowsphone71/Debug/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl40-windowsphone71/Debug/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl40-windowsphone71/Release/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl40-windowsphone71/Release/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl40-windowsphone71/Release/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl40-windowsphone71/Release/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl40/Debug/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl40/Debug/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl40/Debug/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl40/Debug/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl40/Release/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl40/Release/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl40/Release/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl40/Release/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl50/Debug/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl50/Debug/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl50/Debug/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl50/Debug/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl50/Release/WebSocket4Net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl50/Release/WebSocket4Net.dll -------------------------------------------------------------------------------- /Reference/WebSocket4Net/sl50/Release/WebSocket4Net.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/WebSocket4Net/sl50/Release/WebSocket4Net.pdb -------------------------------------------------------------------------------- /Reference/nunit.framework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Reference/nunit.framework.dll -------------------------------------------------------------------------------- /ReleaseProtoBase.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set msbuild="%ProgramFiles(x86)%\MSBuild\14.0\Bin\msbuild.exe" 4 | 5 | %msbuild% SuperSocket.msbuild /t:Release-SuperSocketProtoBase 6 | 7 | pause -------------------------------------------------------------------------------- /SocketBase/Command/CommandUpdateEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Command 7 | { 8 | /// 9 | /// CommandUpdateEventArgs 10 | /// 11 | /// 12 | public class CommandUpdateEventArgs : EventArgs 13 | { 14 | /// 15 | /// Gets the commands updated. 16 | /// 17 | public IEnumerable> Commands { get; private set; } 18 | 19 | /// 20 | /// Initializes a new instance of the class. 21 | /// 22 | /// The commands. 23 | public CommandUpdateEventArgs(IEnumerable> commands) 24 | { 25 | Commands = commands; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SocketBase/Command/ICommandFilterProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Metadata; 6 | 7 | namespace SuperSocket.SocketBase.Command 8 | { 9 | /// 10 | /// The basic interface for CommandFilter 11 | /// 12 | public interface ICommandFilterProvider 13 | { 14 | /// 15 | /// Gets the filters which assosiated with this command object. 16 | /// 17 | /// 18 | IEnumerable GetFilters(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocketBase/Command/StringCommandBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Protocol; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.SocketBase.Command 9 | { 10 | /// 11 | /// A command type for whose request info type is StringPackageInfo 12 | /// 13 | /// The type of the app session. 14 | public abstract class StringCommandBase : CommandBase 15 | where TAppSession : IAppSession, IAppSession, new() 16 | { 17 | 18 | } 19 | 20 | /// 21 | /// A command type for whose request info type is StringPackageInfo 22 | /// 23 | public abstract class StringCommandBase : StringCommandBase 24 | { 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SocketBase/CompositeTargets/ReceiveFilterFactoryCompositeTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition.Hosting; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using SuperSocket.ProtoBase; 8 | using SuperSocket.SocketBase.Protocol; 9 | using SuperSocket.SocketBase.Provider; 10 | 11 | namespace SuperSocket.SocketBase.CompositeTargets 12 | { 13 | class ReceiveFilterFactoryCompositeTarget : SingleResultCompositeTarget> 14 | where TPackageInfo : IPackageInfo 15 | { 16 | public ReceiveFilterFactoryCompositeTarget(Action> callback) 17 | : base((config) => config.ReceiveFilterFactory, callback, false) 18 | { 19 | 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SocketBase/CompositeTargets/SocketServerFactoryComositeTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition.Hosting; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using SuperSocket.Common; 8 | using SuperSocket.SocketBase.Provider; 9 | 10 | namespace SuperSocket.SocketBase.CompositeTargets 11 | { 12 | class SocketServerFactoryComositeTarget : SingleResultCompositeTarget 13 | { 14 | public SocketServerFactoryComositeTarget(Action callback) 15 | : base((config) => config.Options.GetValue("socketServerFactory"), callback, true) 16 | { 17 | 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocketBase/Config/CommandAssemblyConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Config 7 | { 8 | /// 9 | /// Command assembly config 10 | /// 11 | [Serializable] 12 | public class CommandAssemblyConfig : ICommandAssemblyConfig 13 | { 14 | /// 15 | /// Gets or sets the assembly name. 16 | /// 17 | /// 18 | /// The assembly. 19 | /// 20 | public string Assembly { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SocketBase/Config/HotUpdateAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SuperSocket.SocketBase.Config 8 | { 9 | /// 10 | /// the attribute to mark which property of ServerConfig support hot update 11 | /// 12 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)] 13 | public class HotUpdateAttribute : Attribute 14 | { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SocketBase/Config/IBufferPoolConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Config 7 | { 8 | /// 9 | /// Buffer pool configuration interface 10 | /// 11 | public interface IBufferPoolConfig 12 | { 13 | /// 14 | /// Gets the size of the buffer. 15 | /// 16 | /// 17 | /// The size of the buffer. 18 | /// 19 | int BufferSize { get; } 20 | 21 | /// 22 | /// Gets the initial count. 23 | /// 24 | /// 25 | /// The initial count. 26 | /// 27 | int InitialCount { get; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /SocketBase/Config/ICommandAssemblyConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Config 7 | { 8 | /// 9 | /// The basic interface for command assembly config 10 | /// 11 | public interface ICommandAssemblyConfig 12 | { 13 | /// 14 | /// Gets the assembly name. 15 | /// 16 | /// 17 | /// The assembly. 18 | /// 19 | string Assembly { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SocketBase/Config/IListenerConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Config 7 | { 8 | /// 9 | /// The listener configuration interface 10 | /// 11 | public interface IListenerConfig 12 | { 13 | /// 14 | /// Gets the ip of listener 15 | /// 16 | string Ip { get; } 17 | 18 | /// 19 | /// Gets the port of listener 20 | /// 21 | int Port { get; } 22 | 23 | /// 24 | /// Gets the backlog. 25 | /// 26 | int Backlog { get; } 27 | 28 | /// 29 | /// Gets the security option, None/Default/Tls/Ssl/... 30 | /// 31 | string Security { get; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SocketBase/Config/IRootConfig.Net45.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SuperSocket.SocketBase.Config 8 | { 9 | /// 10 | /// IRootConfig, the part compatible with .Net 4.5 or higher 11 | /// 12 | public partial interface IRootConfig 13 | { 14 | /// 15 | /// Gets the default culture for all server instances. 16 | /// 17 | /// 18 | /// The default culture. 19 | /// 20 | string DefaultCulture { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SocketBase/Config/IServerConfig.Net45.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SuperSocket.SocketBase.Config 8 | { 9 | /// 10 | /// IServerConfig, the part compatible with .Net 4.5 or higher 11 | /// 12 | public partial interface IServerConfig 13 | { 14 | /// 15 | /// Gets the default culture for this server. 16 | /// 17 | /// 18 | /// The default culture. 19 | /// 20 | string DefaultCulture { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SocketBase/Config/ITypeProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace SuperSocket.SocketBase.Config 6 | { 7 | /// 8 | /// TypeProvider's interface 9 | /// 10 | public interface ITypeProvider 11 | { 12 | /// 13 | /// Gets the name. 14 | /// 15 | string Name { get; } 16 | 17 | /// 18 | /// Gets the type. 19 | /// 20 | string Type { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SocketBase/Config/RootConfig.Net45.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SuperSocket.SocketBase.Config 8 | { 9 | public partial class RootConfig : IRootConfig 10 | { 11 | /// 12 | /// Gets or sets the default culture. 13 | /// 14 | /// 15 | /// The default culture. 16 | /// 17 | public string DefaultCulture { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocketBase/Config/ServerConfig.Net45.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SuperSocket.SocketBase.Config 8 | { 9 | public partial class ServerConfig : IServerConfig 10 | { 11 | /// 12 | /// Gets or sets the default culture. 13 | /// 14 | /// 15 | /// The default culture. 16 | /// 17 | public string DefaultCulture { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocketBase/Config/TypeProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Configuration; 6 | 7 | namespace SuperSocket.SocketBase.Config 8 | { 9 | /// 10 | /// Type provider configuration 11 | /// 12 | public class TypeProvider : ConfigurationElement, ITypeProvider 13 | { 14 | /// 15 | /// Gets the name. 16 | /// 17 | [ConfigurationProperty("name", IsRequired = true)] 18 | public string Name 19 | { 20 | get { return this["name"] as string; } 21 | } 22 | 23 | /// 24 | /// Gets the type. 25 | /// 26 | [ConfigurationProperty("type", IsRequired = true)] 27 | public string Type 28 | { 29 | get { return this["type"] as string; } 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SocketBase/Config/TypeProviderConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Config 7 | { 8 | /// 9 | /// TypeProviderConfig 10 | /// 11 | [Serializable] 12 | public class TypeProviderConfig : ITypeProvider 13 | { 14 | /// 15 | /// Gets the name. 16 | /// 17 | public string Name { get; set; } 18 | 19 | /// 20 | /// Gets the type. 21 | /// 22 | public string Type { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SocketBase/ICompositeTarget.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.Composition.Hosting; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | 8 | namespace SuperSocket.SocketBase 9 | { 10 | /// 11 | /// The interface for the composite target 12 | /// 13 | public interface ICompositeTarget 14 | { 15 | /// 16 | /// Resolves the specified application server. 17 | /// 18 | /// The application server. 19 | /// The export provider. 20 | /// 21 | bool Resolve(IAppServer appServer, ExportProvider exportProvider); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SocketBase/ISessionBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Net; 6 | 7 | namespace SuperSocket.SocketBase 8 | { 9 | /// 10 | /// The basic session interface 11 | /// 12 | public interface ISessionBase 13 | { 14 | /// 15 | /// Gets the session ID. 16 | /// 17 | string SessionID { get; } 18 | 19 | /// 20 | /// Gets the remote endpoint. 21 | /// 22 | IPEndPoint RemoteEndPoint { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SocketBase/ISystemEndPoint.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase 7 | { 8 | /// 9 | /// The interface for endpoint who can send/receive system message with each other 10 | /// 11 | public interface ISystemEndPoint 12 | { 13 | /// 14 | /// Transfers the system message. 15 | /// 16 | /// Type of the message. 17 | /// The message data. 18 | void TransferSystemMessage(string messageType, object messageData); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /SocketBase/IsolationMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase 7 | { 8 | /// 9 | /// AppServer instance running isolation mode 10 | /// 11 | public enum IsolationMode 12 | { 13 | /// 14 | /// No isolation 15 | /// 16 | None, 17 | /// 18 | /// Isolation by AppDomain 19 | /// 20 | AppDomain, 21 | 22 | /// 23 | /// Isolation by process 24 | /// 25 | Process 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SocketBase/Metadata/CommandAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Metadata 7 | { 8 | /// 9 | /// The command metadata attribute 10 | /// 11 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] 12 | public class CommandAttribute : Attribute 13 | { 14 | /// 15 | /// Gets the key of this command 16 | /// 17 | /// 18 | /// The command key. 19 | /// 20 | public object Key { get; private set; } 21 | 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// The key. 26 | public CommandAttribute(object key) 27 | { 28 | Key = key; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /SocketBase/Pool/BufferPool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Collections.Concurrent; 6 | using System.Threading; 7 | using System.Runtime.InteropServices; 8 | 9 | namespace SuperSocket.SocketBase.Pool 10 | { 11 | class BufferPool : IntelliPool, IBufferPool 12 | { 13 | public int BufferSize { get; private set; } 14 | 15 | public BufferPool(int bufferSize, int initialCount) 16 | : base(initialCount, new BufferItemCreator(bufferSize)) 17 | { 18 | BufferSize = bufferSize; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SocketBase/Pool/IBufferPool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Pool 7 | { 8 | interface IBufferPool : IPool 9 | { 10 | int BufferSize { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /SocketBase/Pool/IPoolItemCreator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Pool 7 | { 8 | /// 9 | /// The pool item creator interface 10 | /// 11 | /// 12 | public interface IPoolItemCreator 13 | { 14 | /// 15 | /// Creates the items of the specified count. 16 | /// 17 | /// The count. 18 | /// 19 | IEnumerable Create(int count); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SocketBase/Pool/IPoolableItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Pool 7 | { 8 | public interface IPoolableItem 9 | { 10 | int Generation { get; } 11 | } 12 | 13 | public interface IPoolableItem : IPoolableItem 14 | where T : IPoolableItem 15 | { 16 | IPool Pool { get; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SocketBase/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SuperSocket.SocketBase")] 9 | [assembly: AssemblyDescription("SuperSocket.SocketBase")] 10 | [assembly: AssemblyConfiguration("")] 11 | 12 | // Setting ComVisible to false makes the types in this assembly not visible 13 | // to COM components. If you need to access a type in this assembly from 14 | // COM, set the ComVisible attribute to true on that type. 15 | [assembly: ComVisible(false)] 16 | 17 | // The following GUID is for the ID of the typelib if this project is exposed to COM 18 | [assembly: Guid("427204a0-fa48-4c22-97d6-4daf08ee4354")] 19 | -------------------------------------------------------------------------------- /SocketBase/Protocol/IProtoSender.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | 7 | namespace SuperSocket.SocketBase.Protocol 8 | { 9 | interface IProtoSender 10 | { 11 | void Send(ISocketSession session, IProtoHandler protoHandler, ArraySegment data); 12 | 13 | void Send(ISocketSession session, IProtoHandler protoHandler, IList> segments); 14 | 15 | bool TrySend(ISocketSession session, IProtoHandler protoHandler, ArraySegment data); 16 | 17 | bool TrySend(ISocketSession session, IProtoHandler protoHandler, IList> segments); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocketBase/Protocol/IProtocolFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.SocketBase.Protocol 9 | { 10 | /// 11 | /// The interface for protocol factory 12 | /// 13 | /// The type of the package information. 14 | public interface IProtocolFactory : IReceiveFilterFactory 15 | where TPackageInfo : IPackageInfo 16 | { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocketBase/Protocol/NewLineProtoTextEncoder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | 7 | namespace SuperSocket.SocketBase.Protocol 8 | { 9 | class NewLineProtoTextEncoder : IProtoTextEncoder 10 | { 11 | private static string s_NewLine = "\r\n"; 12 | 13 | private Encoding m_Encoding; 14 | 15 | public NewLineProtoTextEncoder(Encoding encoding) 16 | { 17 | m_Encoding = encoding; 18 | } 19 | 20 | public IList> EncodeText(string message) 21 | { 22 | return new ArraySegment[] 23 | { 24 | new ArraySegment(m_Encoding.GetBytes(message + s_NewLine)) 25 | }; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SocketBase/ProtocolMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SuperSocket.SocketBase 8 | { 9 | /// 10 | /// Application protocol mode 11 | /// 12 | public enum ProtocolMode 13 | { 14 | /// 15 | /// The command line protocol 16 | /// 17 | CommandLine, 18 | /// 19 | /// The web socket protocol 20 | /// 21 | WebSocket, 22 | /// 23 | /// The custom protocol defined by yourself 24 | /// 25 | Custom 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SocketBase/Provider/IProviderMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace SuperSocket.SocketBase.Provider 8 | { 9 | /// 10 | /// The provider metadata interface 11 | /// 12 | public interface IProviderMetadata 13 | { 14 | /// 15 | /// Gets the name. 16 | /// 17 | /// 18 | /// The name. 19 | /// 20 | string Name { get; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /SocketBase/RequestHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Protocol; 7 | 8 | namespace SuperSocket.SocketBase 9 | { 10 | /// 11 | /// Request handler 12 | /// 13 | /// The type of the app session. 14 | /// The type of the request info. 15 | /// The session. 16 | /// The request info. 17 | public delegate void RequestHandler(TAppSession session, TPackageInfo requestInfo) 18 | where TAppSession : IAppSession, IAppSession, new() 19 | where TPackageInfo : IPackageInfo; 20 | } 21 | -------------------------------------------------------------------------------- /SocketBase/RequestHandlingMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase 7 | { 8 | /// 9 | /// Request handling mode 10 | /// 11 | public enum RequestHandlingMode 12 | { 13 | /// 14 | /// The system IOCP thread pool, the request will be handled by the same IO thread which received the data, default option 15 | /// 16 | Default, 17 | /// 18 | /// Single thread 19 | /// 20 | SingleThread, 21 | 22 | /// 23 | /// The SuperSocket customized thread pool to ensure first received requests must be handled first 24 | /// 25 | CustomThreadPool 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SocketBase/SocketMode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase 7 | { 8 | /// 9 | /// Socket server running mode 10 | /// 11 | public enum SocketMode 12 | { 13 | /// 14 | /// Tcp mode 15 | /// 16 | Tcp, 17 | 18 | /// 19 | /// Udp mode 20 | /// 21 | Udp 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /SocketBase/SuperSocket.SocketBase.Net45.csproj.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /SocketBase/Utils/ISendingQueue.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.SocketBase 9 | { 10 | /// 11 | /// The inertface for sending queue 12 | /// 13 | public interface ISendingQueue : IList>, IOutputBuffer 14 | { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SocketBase/Utils/ITransactionGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Utils 7 | { 8 | /// 9 | /// The interface for group contains many transactional items 10 | /// 11 | public interface ITransactionGroup 12 | { 13 | /// 14 | /// Registers the item. 15 | /// 16 | /// The item. 17 | void RegisterItem(ITransactionItem item); 18 | 19 | /// 20 | /// Commits this transaction. 21 | /// 22 | void Commit(); 23 | 24 | /// 25 | /// Gets all the transaction items. 26 | /// 27 | /// 28 | /// The items. 29 | /// 30 | ITransactionItem[] Items { get; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /SocketBase/Utils/ITransactionItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketBase.Utils 7 | { 8 | /// 9 | /// The interface for transaction item 10 | /// 11 | public interface ITransactionItem 12 | { 13 | /// 14 | /// Rollbacks the transaction item. 15 | /// 16 | void Rollback(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /SocketBase/packages.SuperSocket.SocketBase.Net40.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /SocketBase/packages.SuperSocket.SocketBase.Net45.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /SocketEngine/BufferState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Pool; 6 | using SuperSocket.ProtoBase; 7 | 8 | namespace SuperSocket.SocketEngine 9 | { 10 | sealed class BufferState : BufferBaseState 11 | { 12 | public byte[] Buffer { get; private set; } 13 | 14 | public BufferState(byte[] buffer) 15 | { 16 | Buffer = buffer; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SocketEngine/Configuration/Server.Net45.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Linq; 5 | using System.Text; 6 | using SuperSocket.SocketBase.Config; 7 | 8 | namespace SuperSocket.SocketEngine.Configuration 9 | { 10 | /// 11 | /// Server, the port which is compatible with .Net 4.5 or higher 12 | /// 13 | public partial class Server : IServerConfig 14 | { 15 | /// 16 | /// Gets/sets the default culture for this server. 17 | /// 18 | /// 19 | /// The default culture. 20 | /// 21 | [ConfigurationProperty("defaultCulture", IsRequired = false)] 22 | public string DefaultCulture 23 | { 24 | get 25 | { 26 | return (string)this["defaultCulture"]; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /SocketEngine/Configuration/ServerCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Text; 5 | using SuperSocket.Common; 6 | using SuperSocket.SocketBase.Config; 7 | 8 | namespace SuperSocket.SocketEngine.Configuration 9 | { 10 | /// 11 | /// Server configuration collection 12 | /// 13 | [ConfigurationCollection(typeof(Server), AddItemName = "server")] 14 | public class ServerCollection : GenericConfigurationElementCollection 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SocketEngine/Configuration/SocketServiceConfig.Net45.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Linq; 5 | using System.Text; 6 | using SuperSocket.SocketBase.Config; 7 | 8 | namespace SuperSocket.SocketEngine.Configuration 9 | { 10 | /// 11 | /// SocketServiceConfig, the part which is compatible with .Net 4.5 or higher 12 | /// 13 | public partial class SocketServiceConfig : IConfigurationSource 14 | { 15 | /// 16 | /// Gets/sets the default culture for all server instances. 17 | /// 18 | /// 19 | /// The default culture. 20 | /// 21 | [ConfigurationProperty("defaultCulture", IsRequired = false)] 22 | public string DefaultCulture 23 | { 24 | get 25 | { 26 | return (string)this["defaultCulture"]; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /SocketEngine/DefaultBootstrap.Net45.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Globalization; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace SuperSocket.SocketEngine 8 | { 9 | public partial class DefaultBootstrap 10 | { 11 | partial void SetDefaultCulture(SocketBase.Config.IRootConfig rootConfig) 12 | { 13 | if (!string.IsNullOrEmpty(rootConfig.DefaultCulture)) 14 | CultureInfo.DefaultThreadCurrentCulture = new CultureInfo(rootConfig.DefaultCulture); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SocketEngine/IAsyncSocketEventComplete.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Net.Sockets; 6 | 7 | namespace SuperSocket.SocketEngine 8 | { 9 | interface IAsyncSocketEventComplete 10 | { 11 | void HandleSocketEventComplete(object sender, SocketAsyncEventArgs e); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SocketEngine/IAsyncSocketSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net.Sockets; 5 | using System.Text; 6 | using SuperSocket.Common; 7 | using SuperSocket.SocketBase; 8 | using AnyLog; 9 | 10 | namespace SuperSocket.SocketEngine 11 | { 12 | interface IAsyncSocketSession 13 | { 14 | void ProcessReceive(SocketAsyncEventArgs e); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SocketEngine/IExceptionSource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.Common; 6 | 7 | namespace SuperSocket.SocketEngine 8 | { 9 | interface IExceptionSource 10 | { 11 | event EventHandler ExceptionThrown; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /SocketEngine/IPerformanceMonitor.cs: -------------------------------------------------------------------------------- 1 | using SuperSocket.SocketBase; 2 | using System; 3 | namespace SuperSocket.SocketEngine 4 | { 5 | /// 6 | /// Interface of IPerformanceMonitor 7 | /// 8 | public interface IPerformanceMonitor : IDisposable 9 | { 10 | /// 11 | /// Start PerformanceMonitor. 12 | /// 13 | void Start(); 14 | /// 15 | /// Stop PerformanceMonitor. 16 | /// 17 | void Stop(); 18 | /// 19 | /// Invokes when status update. 20 | /// 21 | event Action OnStatusUpdate; 22 | /// 23 | /// Get or Set status update time in seconds. 24 | /// 25 | int StatusUpdateInterval { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /SocketEngine/IProcessServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace SuperSocket.SocketEngine 7 | { 8 | /// 9 | /// the interface for server instance which works as a process 10 | /// 11 | public interface IProcessServer 12 | { 13 | /// 14 | /// Gets the process id. 15 | /// 16 | /// 17 | /// The process id. If the process id is zero, the server instance is not running 18 | /// 19 | int ProcessId { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SocketEngine/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SuperSocket.SocketEngine")] 9 | [assembly: AssemblyDescription("SuperSocket.SocketEngine")] 10 | [assembly: AssemblyConfiguration("")] 11 | // Setting ComVisible to false makes the types in this assembly not visible 12 | // to COM components. If you need to access a type in this assembly from 13 | // COM, set the ComVisible attribute to true on that type. 14 | [assembly: ComVisible(false)] 15 | 16 | // The following GUID is for the ID of the typelib if this project is exposed to COM 17 | [assembly: Guid("a9e989e2-6cd5-461c-a171-0eacec4e9c0a")] -------------------------------------------------------------------------------- /SocketEngine/SaeState.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase; 7 | using System.Net.Sockets; 8 | using System.Threading; 9 | using SuperSocket.SocketBase.Pool; 10 | 11 | namespace SuperSocket.SocketEngine 12 | { 13 | class SaeState : BufferBaseState 14 | { 15 | public ISocketSession SocketSession { get; internal set; } 16 | 17 | public SocketAsyncEventArgs Sae { get; private set; } 18 | 19 | public SaeState(SocketAsyncEventArgs sae) 20 | { 21 | Sae = sae; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /SocketEngine/ServerResource/SendingQueuePoolResource.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.ServerResource; 6 | using SuperSocket.SocketBase.Utils; 7 | using SuperSocket.SocketBase.Pool; 8 | using SuperSocket.SocketBase.Config; 9 | 10 | namespace SuperSocket.SocketEngine.ServerResource 11 | { 12 | class SendingQueuePoolResource : ServerResourceItem> 13 | { 14 | public SendingQueuePoolResource() 15 | : base("SendingQueuePool") 16 | { 17 | 18 | } 19 | 20 | protected override IPool CreateResource(IServerConfig config) 21 | { 22 | return new IntelliPool(Math.Max(config.MaxConnectionNumber / 6, 256), new SendingQueueSourceCreator(config.SendingQueueSize)); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /SocketEngine/ServerTypeMetadata.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Metadata; 6 | 7 | namespace SuperSocket.SocketEngine 8 | { 9 | [Serializable] 10 | class ServerTypeMetadata 11 | { 12 | public StatusInfoAttribute[] StatusInfoMetadata { get; set; } 13 | 14 | public bool IsServerManager { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /SocketEngine/packages.SuperSocket.SocketEngine.Net40.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /SocketEngine/packages.SuperSocket.SocketEngine.Net45.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /SocketService/ControlCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.SocketService 8 | { 9 | class ControlCommand 10 | { 11 | public string Name { get; set; } 12 | 13 | public string Description { get; set; } 14 | 15 | public Func Handler { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /SocketService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("SuperSocket.SocketService")] 9 | [assembly: AssemblyDescription("SuperSocket.SocketService")] 10 | [assembly: AssemblyConfiguration("")] 11 | // Setting ComVisible to false makes the types in this assembly not visible 12 | // to COM components. If you need to access a type in this assembly from 13 | // COM, set the ComVisible attribute to true on that type. 14 | [assembly: ComVisible(false)] 15 | 16 | // The following GUID is for the ID of the typelib if this project is exposed to COM 17 | [assembly: Guid("641eff4a-4a63-482a-bc40-7d34e2fb4b26")] 18 | -------------------------------------------------------------------------------- /SocketService/supersocket.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | SuperSocket.SocketService.exe -c %1 %2 -------------------------------------------------------------------------------- /SocketService/supersocket.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mono SuperSocket.SocketService.exe -c $1 $2 -------------------------------------------------------------------------------- /Solution Items/GlobalAssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | // Version information for an assembly consists of the following four values: 5 | // 6 | // Major Version 7 | // Minor Version 8 | // Build Number 9 | // Revision 10 | // 11 | [assembly: AssemblyVersion("1.7.0.6")] 12 | [assembly: AssemblyFileVersion("1.7.0.6")] 13 | [assembly: AssemblyCompany("SuperSocket")] 14 | [assembly: AssemblyProduct("SuperSocket")] 15 | [assembly: AssemblyCopyright("Copyright © supersocket.codeplex.com 2010-2016")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] -------------------------------------------------------------------------------- /Solution Items/Net45/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Test/Command/ADD.py: -------------------------------------------------------------------------------- 1 | def execute(session, request): 2 | session.Send(str(int(request[0]) + int(request[1]))) -------------------------------------------------------------------------------- /Test/Command/ADDCS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.Test.Command 9 | { 10 | public class ADDCS : StringCommandBase 11 | { 12 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 13 | { 14 | session.Send((Convert.ToInt32(requestInfo[0]) + Convert.ToInt32(requestInfo[1])).ToString()); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Test/Command/ADDR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.Test.Command 9 | { 10 | public class ADDR : StringCommandBase 11 | { 12 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 13 | { 14 | session.Send("RESU " + (Convert.ToInt32(requestInfo[0]) + Convert.ToInt32(requestInfo[1])).ToString()); 15 | } 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Test/Command/CLOSE.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.SocketBase.Command; 8 | 9 | namespace SuperSocket.Test.Command 10 | { 11 | public class CLOSE : StringCommandBase 12 | { 13 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 14 | { 15 | if (!string.IsNullOrEmpty(requestInfo.Body)) 16 | session.Send(requestInfo.Body); 17 | 18 | session.Close(CloseReason.ServerClosing); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Test/Command/CULT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using SuperSocket.SocketBase.Command; 8 | using SuperSocket.SocketBase.Protocol; 9 | using SuperSocket.ProtoBase; 10 | 11 | namespace SuperSocket.Test.Command 12 | { 13 | public class CULT : StringCommandBase 14 | { 15 | public override void ExecuteCommand(TestSession session, StringPackageInfo packageInfo) 16 | { 17 | session.Send(Thread.CurrentThread.CurrentCulture.Name); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Test/Command/DOMAIN.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.Test.Command 9 | { 10 | public class DOMAIN : StringCommandBase 11 | { 12 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 13 | { 14 | session.Send(AppDomain.CurrentDomain.FriendlyName + "," + AppDomain.CurrentDomain.BaseDirectory); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Test/Command/ECHO.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using SuperSocket.SocketBase.Command; 7 | using SuperSocket.ProtoBase; 8 | 9 | namespace SuperSocket.Test.Command 10 | { 11 | public class ECHO : StringCommandBase 12 | { 13 | private static int m_Sent; 14 | public static string LastSent { get; private set; } 15 | 16 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 17 | { 18 | //Console.WriteLine("R:" + requestInfo.Body); 19 | LastSent = requestInfo.Body; 20 | session.Send(requestInfo.Body); 21 | Interlocked.Increment(ref m_Sent); 22 | } 23 | 24 | public static int Sent 25 | { 26 | get { return m_Sent; } 27 | } 28 | 29 | public static void Reset() 30 | { 31 | m_Sent = 0; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Test/Command/MULT.py: -------------------------------------------------------------------------------- 1 | def execute(session, request): 2 | session.Send(str(int(request[0]) * int(request[1]))) -------------------------------------------------------------------------------- /Test/Command/MULTCS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.Test.Command 9 | { 10 | public class MULTCS : StringCommandBase 11 | { 12 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 13 | { 14 | session.Send((Convert.ToInt32(requestInfo[0]) * Convert.ToInt32(requestInfo[1])).ToString()); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Test/Command/NUM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.Test.Command 9 | { 10 | public class NUM : StringCommandBase 11 | { 12 | public const string ReplyFormat = "325 received {0}!"; 13 | 14 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 15 | { 16 | session.Send(string.Format(ReplyFormat, requestInfo.Body)); 17 | } 18 | 19 | public override string Name 20 | { 21 | get 22 | { 23 | return "325"; 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Test/Command/PARA.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.Test.Command 9 | { 10 | public class PARA : StringCommandBase 11 | { 12 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 13 | { 14 | foreach (var p in requestInfo.Parameters) 15 | { 16 | Console.WriteLine("S: " + p); 17 | session.Send(p); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Test/Command/PROC.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using System.Text; 6 | using SuperSocket.ProtoBase; 7 | using SuperSocket.SocketBase.Command; 8 | 9 | namespace SuperSocket.Test.Command 10 | { 11 | public class PROC : StringCommandBase 12 | { 13 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 14 | { 15 | session.Send(AppDomain.CurrentDomain.FriendlyName + "," + AppDomain.CurrentDomain.BaseDirectory); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Test/Command/RESU.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.Test.Command 9 | { 10 | public class RESU : StringCommandBase 11 | { 12 | public static string Result { get; private set; } 13 | 14 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 15 | { 16 | Result = requestInfo.Body; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Test/Command/SESS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.Test.Command 9 | { 10 | public class SESS : StringCommandBase 11 | { 12 | public override void ExecuteCommand(TestSession session, StringPackageInfo requestInfo) 13 | { 14 | session.Send(session.SessionID); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Test/Common/AssemblyUtilTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using NUnit.Framework; 6 | using SuperSocket.SocketBase.Config; 7 | using SuperSocket.Common; 8 | 9 | namespace SuperSocket.Test.Common 10 | { 11 | [TestFixture] 12 | public class AssemblyUtilTest 13 | { 14 | [Test] 15 | public void TestCopyProperties() 16 | { 17 | var config = new ServerConfig(); 18 | config.Name = "Kerry"; 19 | config.Port = 21; 20 | var newConfig = new ServerConfig(); 21 | config.CopyPropertiesTo(newConfig); 22 | 23 | Assert.AreEqual(config.Name, newConfig.Name); 24 | Assert.AreEqual(config.Port, newConfig.Port); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Test/Config/ActiveConnectServer.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 12 | 13 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Test/Config/AppDomain.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Test/Config/Basic.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Test/Config/ChildConfigA.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Test/Config/ChildConfigB.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Test/Config/ChildConfigC.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Test/Config/ChildConfigD.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Test/Config/ConnectionFilter.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Test/Config/DefaultCultureA.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 9 | 10 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Test/Config/DefaultCultureB.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 10 | 11 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Test/Config/Listeners.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Test/Config/ProcessIsolation.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Test/Config/ProcessTestServer.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 13 | 14 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Test/Config/ServerType.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Test/ITestSetup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Config; 6 | 7 | namespace SuperSocket.Test 8 | { 9 | public interface ITestSetup 10 | { 11 | void Setup(IRootConfig rootConfig, IServerConfig serverConfig); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Test/Protocol/TerminatorProtocolTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using NUnit.Framework; 6 | using SuperSocket.ProtoBase; 7 | using SuperSocket.SocketBase.Protocol; 8 | 9 | namespace SuperSocket.Test.Protocol 10 | { 11 | [TestFixture] 12 | public class TerminatorProtocolTest : ProtocolTestBase 13 | { 14 | private readonly Encoding m_Encoding = new ASCIIEncoding(); 15 | 16 | protected override IReceiveFilterFactory CurrentReceiveFilterFactory 17 | { 18 | get { return new TerminatorReceiveFilterFactory("##", m_Encoding); } 19 | } 20 | 21 | protected override string CreateRequest(string sourceLine) 22 | { 23 | return string.Format("ECHO {0}##", sourceLine); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Test/TestRequestParser.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.ProtoBase; 6 | using SuperSocket.SocketBase.Command; 7 | 8 | namespace SuperSocket.Test 9 | { 10 | public class TestRequestParser : IStringParser 11 | { 12 | public void Parse(string source, out string key, out string body, out string[] parameters) 13 | { 14 | key = string.Empty; 15 | body = string.Empty; 16 | parameters = null; 17 | 18 | int pos = source.IndexOf(':'); 19 | 20 | if (pos <= 0) 21 | return; 22 | 23 | key = source.Substring(0, pos); 24 | body = source.Substring(pos + 1); 25 | 26 | if (!string.IsNullOrEmpty(body)) 27 | parameters = body.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Test/Udp/MyUdpProtocol.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net; 5 | using System.Text; 6 | using SuperSocket.ProtoBase; 7 | using SuperSocket.SocketBase; 8 | using SuperSocket.SocketBase.Protocol; 9 | 10 | namespace SuperSocket.Test.Udp 11 | { 12 | class MyUdpProtocol : IReceiveFilterFactory 13 | { 14 | public IReceiveFilter CreateFilter(IAppServer appServer, IAppSession appSession, IPEndPoint remoteEndPoint) 15 | { 16 | return new MyReceiveFilter(); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Test/Udp/SESS.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase.Command; 6 | 7 | namespace SuperSocket.Test.Udp 8 | { 9 | public class SESS : CommandBase 10 | { 11 | public override void ExecuteCommand(UdpTestSession session, MyUdpRequestInfo requestInfo) 12 | { 13 | session.Send(new ArraySegment(Encoding.UTF8.GetBytes(session.SessionID + " " + requestInfo.Value))); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Test/Udp/UdpAppServer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.Dlr; 6 | using SuperSocket.SocketBase; 7 | using SuperSocket.SocketBase.Command; 8 | using SuperSocket.SocketBase.Config; 9 | using AnyLog; 10 | using SuperSocket.ProtoBase; 11 | using SuperSocket.SocketEngine; 12 | using SuperSocket.SocketBase.Protocol; 13 | 14 | namespace SuperSocket.Test.Udp 15 | { 16 | class UdpAppServer : AppServer, ITestSetup 17 | { 18 | public UdpAppServer() 19 | : base(new DefaultReceiveFilterFactory()) 20 | { 21 | 22 | } 23 | 24 | void ITestSetup.Setup(IRootConfig rootConfig, IServerConfig serverConfig) 25 | { 26 | base.Setup(rootConfig, serverConfig, null, new ConsoleLoggerFactory(), null); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Test/Udp/UdpTestSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using SuperSocket.SocketBase; 6 | 7 | namespace SuperSocket.Test.Udp 8 | { 9 | public class UdpTestSession : AppSession 10 | { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Test/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Test/supersocket.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cnsuhao/SuperSocket/0875d6c05133824e67b7e0f9d7f5bad76471e1b6/Test/supersocket.pfx -------------------------------------------------------------------------------- /WARNING.txt: -------------------------------------------------------------------------------- 1 | This branch is for developing purpose and in unstable status, so it cannot be used for production usage. --------------------------------------------------------------------------------