Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

TCP/IP Chat Application Using C#

, 30 Jan 2006
This is a LAN chat application with TCP/IP socket programming technology in C#. This application is a multi thread network application and works in a non-blocking way. Public and private chat is also implemented in this code.
demo.zip
Demo
ChatClient.exe
CommandClient.dll
CommandServer.dll
ConsoleServer.exe
P_0_0_0.U_0.dll
source.zip
CommandServer
CommandServer
bin
Debug
Properties
ConsoleServer
bin
Debug
obj
Debug
Refactor
ResolveAssemblyReference.cache
TempPE
Properties
CommandClient
ChatClient
bin
Debug
ChatClient.csproj.user
CSS
Graphics
arrow.gif
back.gif
face.gif
Icons
Enter.ico
Exit.ico
Private.ico
Save.ico
SendMessage.ico
Smiely.ico
Images
arrow.gif
Enter.png
Exit.png
face.gif
MNUBack.png
Private.png
Save.png
Smiely.png
Properties
Settings.settings
SoundResources
Door.wav
Knock.wav
Message.wav
Pow.wav
CommandClient
bin
Debug
obj
Debug
TempPE
Properties
P_0_0_0.U_0.dll
using System;
using System.Collections.Generic;
using System.Text;

namespace Proshot.CommandClient
{
    /// <summary>
    /// The type of commands that you can sent to the server.(Note : These are just some comman types.You should do the desired actions when a command received to the client yourself.)
    /// </summary>
    public enum CommandType
    {
        /// <summary>
        /// Force the target to logoff from the application without prompt.Pass null or "" as command's Metadata.
        /// </summary>
        UserExit ,
        /// <summary>
        /// Force the target to logoff from the application with prompt.Pass the timer interval of logoff action as command's Metadata in miliseconds.For example "20000".
        /// </summary>
        UserExitWithTimer ,
        /// <summary>
        /// Force the target PC to LOCK without prompt.Pass null or "" as command's Metadata.
        /// </summary>
        PCLock ,
        /// <summary>
        /// Force the target PC to LOCK with prompt.Pass the timer interval of LOCK action as command's Metadata in miliseconds.For example "20000".
        /// </summary>
        PCLockWithTimer ,
        /// <summary>
        /// Force the target PC to RESTART without prompt.Pass null or "" as command's Metadata.
        /// </summary>
        PCRestart ,
        /// <summary>
        /// Force the target PC to RESTART with prompt.Pass the timer interval of RESTART action as command's Metadata in miliseconds.For example "20000".
        /// </summary>
        PCRestartWithTimer ,
        /// <summary>
        /// Force the target PC to LOGOFF without prompt.Pass null or "" as command's Metadata.
        /// </summary>
        PCLogOFF ,
        /// <summary>
        /// Force the target PC to LOGOFF with prompt.Pass the timer interval of LOGOFF action as command's Metadata in miliseconds.For example "20000".
        /// </summary>
        PCLogOFFWithTimer ,
        /// <summary>
        /// Force the target PC to SHUTDOWN without prompt.Pass null or "" as command's Metadata.
        /// </summary>
        PCShutDown ,
        /// <summary>
        /// Force the target PC to SHUTDOWN with prompt.Pass the timer interval of SHUTDOWN action as command's Metadata in miliseconds.For example "20000".
        /// </summary>
        PCShutDownWithTimer ,
        /// <summary>
        /// Send a text message to the server.Pass the body of text message as command's Metadata.
        /// </summary>
        Message ,
        /// <summary>
        /// This command will sent to all clients when an specific client is had been logged in to the server.The metadata of this command is in this format : "ClientIP:ClientNetworkName"
        /// </summary>
        ClientLoginInform ,
        /// <summary>
        /// This command will sent to all clients when an specific client is had been logged off from the server.You can get the disconnected client information from SenderIP and SenderName properties of command event args.
        /// </summary>
        ClientLogOffInform ,
        /// <summary>
        /// To ask from the server pass the name that you want check it's existance as meta data of command.The server will replay to you a command with the same type and MetaData of 'True' or 'False' that specifies the Network name is exists on the server or not.
        /// </summary>
        IsNameExists,
        /// <summary>
        /// To get a list of current connected clients to the server,Send this type of command to it.The server will replay to you one same command for each client with the metadata in this format : "ClientIP:ClientNetworkName".
        /// </summary>
        SendClientList,
        /// <summary>
        /// This is a free command that you can sent to the server.
        /// </summary>
        FreeCommand
    }
}

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

ALLEXY
Software Developer (Senior)
Australia Australia
MCPD
MCTS: ASP.NET Applications
MCTS: ADO.NET Applications
MCTS: Windows Forms Applications
MCTS: Windows Communication Foundation Applications
MCPD: Enterprise Application Developer

| Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 31 Jan 2006
Article Copyright 2006 by ALLEXY
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid