- tcpwin_clientcmd.zip
- TCPWin_ClientCMD
- ICSharpCode.SharpZipLib.dll
- PluginInMannager.dll
- plugins
- FileSystemClient.dll
- RemoteDesktopClient.dll
- TCPClient.dll
- TCPClientCmd.exe
- tcp_client_server.zip
- TCP_client_server
- NET
- build.bat
- FileSystemClient
- FileSystemServer
- ICSharpCode.SharpZipLib.dll
- PluginInManager
- RemoteDesktopClient
- RemoteDesktopServer
- TCP_WIN_APP.sln
- TCPClient
- TCPClientCmd
- TCPClientWin
- TCPServer
- NETCF
- tcpwin_client.zip
- TCPWin_Client
- ICSharpCode.SharpZipLib.dll
- Interop.Shell32.dll
- Log
- PluginInMannager.dll
- plugins
- FileSystemClient.dll
- RemoteDesktopClient.dll
- TCPClient.dll
- TCPClientWin.exe
- tcpcf_server.zip
- TCPCF_Server
- ICSharpCode.SharpZipLib.dll
- PlugInManager.dll
- plugins
- FileSystemServer.dll
- RemoteDesktopServer.dll
- TCPServer.exe
- tcpwin_server.zip
- TCPWin_Server
- ICSharpCode.SharpZipLib.dll
- PluginInMannager.dll
- plugins
- FileSystemServer.dll
- SimpleRemoteDesktopServer.dll
- TCPServer.exe
|
//-----------------------------------------------------------------------
// <copyright file="Form1.cs" company="Matjazev.NET">
// Copyright (c) www.matjazev.net. All rights reserved.
// </copyright>
// <author>Matjaz Prtenjak</author>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
namespace TCPServer
{
public partial class Form1 : Form
{
private Matjazev.Tcp.TcpServer tcpServer = null;
private List<string> ipDescriptions = new List<string>();
private int ipDescriptionPos = 0;
private void showLabel(object sender, EventArgs e)
{
bool working = (this.tcpServer != null) && (this.tcpServer.IsWorking);
lblInfo.Text = (working) ? "Server running" : "Server stopped";
lblIP.Visible = working;
}
public Form1()
{
InitializeComponent();
string programPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
this.tcpServer = new Matjazev.Tcp.TcpServer(programPath);
this.tcpServer.StatusChanged += this.showLabel;
this.showLabel(this.tcpServer, null);
}
private void lblInfo_Click(object sender, EventArgs e)
{
this.ipDescriptionPos++;
if (this.ipDescriptionPos >= this.ipDescriptions.Count) this.ipDescriptionPos = 0;
lblIP.Text = this.ipDescriptions[this.ipDescriptionPos];
}
private void button1_Click(object sender, EventArgs e)
{
this.tcpServer.Start(15555);
IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName());
int cntr = 0;
foreach (IPAddress addr in host.AddressList)
this.ipDescriptions.Add(string.Format("IP {2} ({0}/{1})", ++cntr, host.AddressList.Length, addr.ToString()));
this.ipDescriptionPos = -1;
this.lblInfo_Click(this, e);
}
private void button2_Click(object sender, EventArgs e)
{
this.tcpServer.Stop();
Close();
}
private void Form1_Closing(object sender, CancelEventArgs e)
{
if (this.tcpServer.IsWorking) this.tcpServer.Stop();
}
}
}
|
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.
I am a software developer in one of the largest retailer in our country. My job is (beside else) also in setting some standards in SW development throughout our company.
I have a M.Sc. in computer science and 20 years of experience. I have written 2 books in Slovenian language and both are sold out (the first about C++ language and the second about VBA language)...