- asyncsocketserverandclient.zip
- Code
- ALAZ Library.sln
- Demos
- CertificateCreation
- Chat
- ChatClient
- ChatConsoleServer
- ChatCryptService
- ChatServiceServer
- ChatSocketService
- Echo
- EchoConsoleClient
- EchoConsoleServer
- EchoCryptService
- EchoForm
- EchoFormClient
- EchoFormClientSynch
- EchoFormServer
- EchoSocketService
- EchoWindowsServiceServer
- Readme.txt
- Source
- ALAZ.SystemEx.NetEx
- ALAZ.SystemEx.NetEx.csproj
- ALAZ.SystemEx.NetEx.csproj.user
- ALAZLibSN.snk
- bin
- Debug
- Release
- ALAZ.SystemEx.dll
- ALAZ.SystemEx.NetEx.dll
- ALAZ.SystemEx.NetEx.pdb
- ALAZ.SystemEx.pdb
- Properties
- SocketsEx
- ALAZ.SystemEx
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Threading;
using EchoSocketService;
namespace EchoFormTemplate
{
public partial class frmEchoForm : Form
{
public OnEventDelegate FEvent;
private int FConnectionCount;
public frmEchoForm()
{
InitializeComponent();
}
public void Event(string eventMessage)
{
Event(eventMessage, false);
}
public void Event(string eventMessage, bool ex)
{
if (lstMessages.InvokeRequired)
{
lstMessages.Invoke(new OnEventDelegate(delegate(string s) { Event(s); }), eventMessage);
}
else
{
if (eventMessage.Contains("Connected"))
{
Interlocked.Increment(ref FConnectionCount);
}
if (eventMessage.Contains("Disconnected"))
{
Interlocked.Decrement(ref FConnectionCount);
}
this.Text = FConnectionCount.ToString() + " Connections";
string[] s = eventMessage.Split('\n');
for (int i = s.Length - 1; i >= 0; i--)
{
lstMessages.BeginUpdate();
lstMessages.Items.Insert(0, s[i]);
if (lstMessages.Items.Count > 100)
lstMessages.Items.RemoveAt(100);
lstMessages.EndUpdate();
}
}
}
private void frmServer_Load(object sender, EventArgs e)
{
FEvent = new OnEventDelegate(Event);
FConnectionCount = 0;
}
public void OnException(Exception ex)
{
Event("Service Exception! - " + ex.Message, true);
Event("------------------------------------------------", true);
}
private void lstMessages_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service 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.