Click here to Skip to main content
13,344,281 members (49,225 online)
Click here to Skip to main content
Add your own
alternative version


30 bookmarked
Posted 3 Feb 2006

LAN Chat Using Multicating

, 3 Feb 2006
Rate this:
Please Sign up or sign in to vote.
An article on LAN chat using multicasting.

Sample Image - LanChat.jpg


This is the Simple Project Will demonstrate the use of multicating in Lan Chat.


"IP Multicasting is a bandwidth-conserving technology that reduces traffic by simultaneously delivering a single stream of information to thousands of corporate recipients and homes."CSCO01.

To transmit a single message to a select group of recipients. A simple example of multicasting is sending an e-mail message to a mailing list. Teleconferencing and videoconferencing also use multicasting, but require more robust protocols and networks.

And Multicasting is Controlled By IGMP ( Internet Group Management Protocol).

Using the code

In LanChat there is only one exe, It Consists of one thread to listen in multicast address throught port 1000. To accept in comming Advertisements from any machine in local Lan. Then it maintains the list of available Users.

And the message send to particular client using Another UDP.

It is very simple and usefull for office environment. 


  1. Run LanChat in one machine.
  2. Click Advertise Button. Then you will be listed in all other LanChat's.
  3. And then Send messages...  


Socket s = new Socket(AddressFamily.InterNetwork, 
               SocketType.Dgram, ProtocolType.Udp);
IPEndPoint ipep = new IPEndPoint(IPAddress.Any,int.Parse(port));
IPAddress ip=IPAddress.Parse(mcastGroup);
        new MulticastOption(ip,IPAddress.Any));

SEND Message:

  IPAddress GroupAddress = IPAddress.Parse(mAddress);
  int GroupPort = port;
  UdpClient sender = new UdpClient();
  IPEndPoint groupEP = new IPEndPoint(GroupAddress,GroupPort);
  byte[] bytes = Encoding.ASCII.GetBytes(message);
  sender.Send(bytes, bytes.Length, groupEP);
catch (Exception e) 

Points of Interest

I hope you've enjoyed this little tutorial. In future i will provide you lot more stuffs, And I am expecteding your valuable suggestions.


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


About the Author

Andrews Raj
Software Developer (Senior)
India India
I am a software engineer working in Blr, india.
working in c++, vc++, mfc, c#.Net, COM/ATL.

You may also be interested in...


Comments and Discussions

QuestionThrowing Exception Pin
prasad@12348-Mar-13 1:41
memberprasad@12348-Mar-13 1:41 
QuestionSend File Pin
Brindaa9-Jun-12 4:55
memberBrindaa9-Jun-12 4:55 
Questionhow to change the path , if one path is busy in network Pin
velava6430-Sep-09 21:44
membervelava6430-Sep-09 21:44 
QuestionHard coded IP? Pin
Roonda5-May-08 16:09
memberRoonda5-May-08 16:09 
AnswerRe: Hard coded IP? Pin
Andrews Raj17-May-08 0:41
memberAndrews Raj17-May-08 0:41 
GeneralMultiCat Pin
rajeev829-Oct-07 3:58
memberrajeev829-Oct-07 3:58 
Generalip multicasting and remote Pin
balazs_hideghety13-Aug-07 7:13
memberbalazs_hideghety13-Aug-07 7:13 
Gigi Carlino26-Oct-06 7:13
memberGigi Carlino26-Oct-06 7:13 
GeneralRe: UDP MESSAGE Pin
Andrews Raj28-Dec-06 0:57
memberAndrews Raj28-Dec-06 0:57 
Generalhi andrews Pin
sudharsong24-Apr-06 20:32
membersudharsong24-Apr-06 20: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.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.180111.1 | Last Updated 3 Feb 2006
Article Copyright 2006 by Andrews Raj
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid