Click here to Skip to main content
15,890,438 members
Articles / Programming Languages / C#
Article

A Simple Chat Application Using .NET Remoting

Rate me:
Please Sign up or sign in to vote.
2.57/5 (41 votes)
13 Nov 20011 min read 309.4K   5.8K   70   65
This application demonstrates .NET remoting in LAN.
Sample Image - DotNETChatApplication.gif

Introduction

The application is a simple chat tool. Anyone who connects to the chat server receives all chat communication between the connected users. The application is deliberately kept simple to clarify .NET remoting. This application also demonstrates event and delegate usage in an application that uses .NET remoting.

Description

Most of you will have noticed that there are wizards to develop ASP.NET web services in Visual Studio .NET. However, if you want to develop a Client/Server application that runs over a local area network, there are no wizards available. This application shows how to do .NET remoting in a Local Area Network. This application acts much like a DCOM server and client application. This Visual Studio .NET solution contains three modules.

  1. ChatCoordinator: The server implementation.
  2. ChatClient: The client implementation.
  3. ChatServer: The runtime host for Chat coordinator.

This uses HTTP protocol schema and sends the messages through an HTTP channel. The remoting configuration is specified in the ChatClient.exe.config file and the ChatServer.exe.config file.

How to Build the Application

  • Step-1: Extract the file DotNETChatApplication_demo.zip.
  • Step-2: Open the file ChatApplication.sln in Visual studio .NET.
  • Step-3: Build the Solution.

How to Run the Application

  • Step-1: Locate the folder Output under the project folder.
  • Step-2: Run the server application ChatServer.exe.
  • Step-3: Run the chat client ChatClient.exe.

This application runs on a single computer or across a network. If you want to run this application over a network, you must replace "localhost" in the client configuration with the name of the remote computer. Modify the following line in Client.exe.config:

XML
<wellknown type="ChatCoordinator.ChatCenter, ChatCoordinator" 
    url="http://localhost:100/ChatServer" />

...to:

XML
<wellknown type="ChatCoordinator.ChatCenter, ChatCoordinator" 
    url="http://your machine name:100/ChatServer" />

Also make sure that the ChatServer.exe is running before you run ChatClient.exe.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
AnswerRe: Error in Client: &amp;amp;amp;quot;can't deserialize in the security layer??? [modified] Pin
coder2558-Apr-07 6:53
coder2558-Apr-07 6:53 
QuestionRe: Error in Client: &amp;amp;amp;quot;can't deserialize in the security layer??? Pin
qbxp9-Jul-07 16:55
qbxp9-Jul-07 16:55 
GeneralRe: Error in Client: &amp;amp;amp;quot;can't deserialize in the security layer??? Pin
Jim Weiler16-Aug-07 3:40
Jim Weiler16-Aug-07 3:40 
AnswerSolution to Security deserialization error & cross-thread exceptions Pin
andrei_t34-Apr-08 9:53
andrei_t34-Apr-08 9:53 
GeneralHelp Needed Pin
Member 45748423-Sep-03 19:53
Member 45748423-Sep-03 19:53 
General.config files missing Pin
sqrt2is141426-Jul-03 21:40
sqrt2is141426-Jul-03 21:40 
GeneralRe: .config files missing Pin
Melan18-Nov-03 21:05
Melan18-Nov-03 21:05 
GeneralRe: .config files missing Pin
keeper_corp17-Dec-03 7:31
keeper_corp17-Dec-03 7:31 
Simply create a text file (with notepad for example) named chatclient.exe.config (attention, not chatclient.exe.config.txt!!!) with the following contents:

<wellknown type="ChatCoordinator.ChatCenter, ChatCoordinator" url="http://localhost:100/ChatServer">


Then create a second file with the same contents but named chatserver.exe.config

If you place this files in the ouput directory it should do the job.

ESTV
GeneralRe: .config files missing Pin
keeper_corp17-Dec-03 7:32
keeper_corp17-Dec-03 7:32 
GeneralRe: .config files missing Pin
Member 187140113-Sep-05 1:39
Member 187140113-Sep-05 1:39 
GeneralRe: .config files missing Pin
ansasri4-Dec-04 0:08
ansasri4-Dec-04 0:08 
GeneralFew questions. Pin
hlbcal6-Jul-03 17:30
hlbcal6-Jul-03 17:30 
GeneralVs 2003 Pin
moosetea23-Jun-03 0:35
moosetea23-Jun-03 0:35 
Questionhow to debug that program Pin
mr_hai12-Jun-03 17:14
mr_hai12-Jun-03 17:14 
GeneralThe Client wont start Pin
ThePhantomMenace13-May-03 22:52
ThePhantomMenace13-May-03 22:52 
GeneralStudent need your Help Pin
nisa27-Apr-03 21:09
nisa27-Apr-03 21:09 
GeneralHelp me please Pin
TheXeon10-Mar-03 13:00
TheXeon10-Mar-03 13:00 
GeneralRe: Help me please Pin
Silverman17-Mar-03 4:28
Silverman17-Mar-03 4:28 
GeneralRe: Help me please Pin
psiufoxx19-Mar-03 10:13
psiufoxx19-Mar-03 10:13 
GeneralRe: Help me please Pin
Anonymous30-Mar-03 7:28
Anonymous30-Mar-03 7:28 
GeneralRe: Help me please Pin
Anonymous26-Mar-03 3:15
Anonymous26-Mar-03 3:15 
GeneralRe: Help me please Pin
bellerofonte2-Sep-04 0:24
bellerofonte2-Sep-04 0:24 
QuestionCatched by the event trap? Pin
knorkator19-Nov-02 2:58
knorkator19-Nov-02 2:58 
GeneralSecond client did not start Pin
Anonymous13-Oct-02 22:51
Anonymous13-Oct-02 22:51 
GeneralRe: Second client did not start Pin
jpazos25-Aug-04 12:32
jpazos25-Aug-04 12:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.