Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,164,466 members, 7,857,764 topics. Date: Wednesday, 12 June 2024 at 12:23 AM

Chat Room Application - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Chat Room Application (2694 Views)

Chat Room For Coders Who Love Movies... / Chat Room For Nairaland? (2) (3) (4)

(1) (Reply) (Go Down)

Chat Room Application by dansmog(m): 4:08pm On Feb 10, 2012
pls i want to create a chat room from scratch for my wap site, any help for this and where i can get tutorial on this
Re: Chat Room Application by Fayimora(m): 3:00pm On Feb 12, 2012
You dont just get a tutorial on how to create a chat room application. THere are issues you have to resolve before any implementation. What platform are you developing for? Features to be included any many more
Re: Chat Room Application by logic101: 7:53pm On Feb 12, 2012
You can use multicasting in java to write one but think of what fayimora said.
Re: Chat Room Application by csharpjava(m): 10:05pm On Feb 12, 2012
Here is a C# version of a multicast chat application. Follow this link for more info: C# / C Sharp » Network » Chat


/*
C# Network Programming
by Richard Blum

Publisher: Sybex
ISBN: 0782141765
*/
using System;
using System.Drawing;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Windows.Forms;

public class MulticastChat : Form
{
   TextBox newText;
   ListBox results;
   Socket sock;
   Thread receiver;
   IPEndPoint multiep = new IPEndPoint(IPAddress.Parse("224.100.0.1"wink, 9050);

   public MulticastChat()
   {
      Text = "Multicast Chat Program";
      Size = new Size(400, 380);

      Label label1 = new Label();
      label1.Parent = this;
      label1.Text = "Enter text string:";
      label1.AutoSize = true;
      label1.Location = new Point(10, 30);

      newText = new TextBox();
      newText.Parent = this;
      newText.Size = new Size(200, 2 * Font.Height);
      newText.Location = new Point(10, 55);

      results = new ListBox();
      results.Parent = this;
      results.Location = new Point(10, 85);
      results.Size = new Size(360, 18 * Font.Height);

      Button sendit = new Button();
      sendit.Parent = this;
      sendit.Text = "Send";
      sendit.Location = new Point(220,52);
      sendit.Size = new Size(5 * Font.Height, 2 * Font.Height);
      sendit.Click += new EventHandler(ButtonSendOnClick);

      Button closeit = new Button();
      closeit.Parent = this;
      closeit.Text = "Close";
      closeit.Location = new Point(290, 52);
      closeit.Size = new Size(5 * Font.Height, 2 * Font.Height);
      closeit.Click += new EventHandler(ButtonCloseOnClick);

      sock = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
      IPEndPoint iep = new IPEndPoint(IPAddress.Any, 9050);
      sock.Bind(iep);
      sock.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("224.100.0.1"wink));
      receiver = new Thread(new ThreadStart(packetReceive));
      receiver.IsBackground = true;
      receiver.Start();
   }

   void ButtonSendOnClick(object obj, EventArgs ea)
   {
      byte[] message = Encoding.ASCII.GetBytes(newText.Text);
      newText.Clear();
      sock.SendTo(message, SocketFlags.None, multiep);
   }

   void ButtonCloseOnClick(object obj, EventArgs ea)
   {
      receiver.Abort();
      sock.Close();
      Close();
   }

   void packetReceive()
   {
      EndPoint ep = (EndPoint)multiep;
      byte[] data = new byte[1024];
      string stringData;
      int recv;
      while (true)
      {
         recv = sock.ReceiveFrom(data, ref ep);
         stringData = Encoding.ASCII.GetString(data, 0, recv);
         results.Items.Add("from " + ep.ToString() + ":  " + stringData);
      }
   }

   public static void Main()
   {
      Application.Run(new MulticastChat());
   }
}
Re: Chat Room Application by dansmog(m): 5:49pm On Mar 06, 2012
thanks for all your post abt this thread, bt the thing is i want to use php and maybe javascript, isnt it possible?
Re: Chat Room Application by dansmog(m): 5:55pm On Mar 06, 2012
@fayimora, pls what are the implementations needed?
Re: Chat Room Application by Kobojunkie: 6:02pm On Mar 06, 2012
^^^ Learn to do some googling please
Re: Chat Room Application by kiranatama: 8:01am On Mar 07, 2012
Re: Chat Room Application by dansmog(m): 9:38pm On Mar 07, 2012
thanks i appreciate you guys help to me! thank you one more time

(1) (Reply)

Help:i Want To Build A Cbt Exam Based App / How Do I Learn How To Build Mobile Apps? / Vb.net For Dummies:

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 18
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.