using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.ServiceProcess; using System.Text; using System.Threading; using System.Net; using System.Net.Sockets; using ALAZ.SystemEx.NetEx.SocketsEx; namespace ChatServiceServer { public partial class ChatServiceServer : ServiceBase { private SocketServer chatServer; public ChatServiceServer() { InitializeComponent(); } protected override void OnStart(string[] args) { chatServer = new SocketServer( CallbackThreadType.ctWorkerThread, new ChatSocketService.ChatSocketService()); chatServer.Delimiter = new byte[] { 0xAA, 0xFF, 0xAA }; chatServer.DelimiterType = DelimiterType.dtMessageTailExcludeOnReceive; chatServer.SocketBufferSize = 1024; chatServer.MessageBufferSize = 512; //----- Socket Listener! SocketListener listener = chatServer.AddListener("Char Server", new IPEndPoint(IPAddress.Any, 8090)); listener.AcceptThreads = 3; listener.BackLog = 50; listener.CompressionType = CompressionType.ctNone; listener.EncryptType = EncryptType.etRijndael; listener.CryptoService = new ChatCryptService.ChatCryptService(); chatServer.Start(); } protected override void OnStop() { chatServer.Stop(); chatServer.Dispose(); chatServer = null; } } }
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Old Japanese Man Creates Amazing Art Using Excel (Wait, Excel?)