![]() |
Languages »
C# »
General
Intermediate
LAN Chat Using MulticatingBy Andrews RajAn article on LAN chat using multicasting. |
C#, Windows, .NET, Visual Studio, Dev
|
||||||||
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||

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).
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.
STEPS
Socket s = new Socket(AddressFamily.InterNetwork,
SocketType.Dgram, ProtocolType.Udp);
IPEndPoint ipep = new IPEndPoint(IPAddress.Any,int.Parse(port));
s.Bind(ipep);
IPAddress ip=IPAddress.Parse(mcastGroup);
s.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.AddMembership,
new MulticastOption(ip,IPAddress.Any));
try
{
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);
sender.Close();
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
I hope you've enjoyed this little tutorial. In future i will provide you lot more stuffs, And I am expecteding your valuable suggestions.
| You must Sign In to use this message board. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
General
News
Question
Answer
Joke
Rant
Admin
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 3 Feb 2006 Editor: |
Copyright 2006 by Andrews Raj Everything else Copyright © CodeProject, 1999-2009 Web09 | Advertise on the Code Project |