Serverless LAN Chat Application Best Practices?

Questions Best Practices involved in a Serverless LAN Chat application

Page 1 of 1

5 Replies - 17046 Views - Last Post: 31 July 2008 - 12:12 AM

#1 RodgerB  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 66
  • View blog
  • Posts: 2,284
  • Joined: 21-September 07

Serverless LAN Chat Application Best Practices?

Posted 23 February 2008 - 03:02 AM

I have recently taken it upon myself to create a simple lan chat application out of a .NET language, being either VB.NET or C# as I am strongest in these programming languages. I know there are plenty of other applications out there that serve the same purpose as I am looking for, but I'd really like to get an understanding of it myself.

I know I could easily be able to accomplish this task, but I would like to do it as fast as possible. The hypothesis I have is as follows when the user presses the send button:

1) Get all computers on the network.
2) Send a packet to a port the application will be running, e.g. 6891 using the TcpClient method.
3) Parse the packet to a RichTextBox.

I know that getting all the computers on a network is going to be painful with speed, let alone the fact sending a packet to every machine is going to create a lot of overhead on the network bandwidth if somebody decides to spam crazily.

What method would you suggest me using? I'd rather not add a server application, this is all part of the challenge for me :) . Thanks in advance. :)

Is This A Good Question/Topic? 0
  • +

Replies To: Serverless LAN Chat Application Best Practices?

#2 MorphiusFaydal  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 43
  • View blog
  • Posts: 1,376
  • Joined: 12-May 05

Re: Serverless LAN Chat Application Best Practices?

Posted 23 February 2008 - 07:23 PM

At the place I used to work, we used a program called BORGChat. I don't think you can download and look at the source, but it might help you anyway...
Was This Post Helpful? 0
  • +
  • -

#3 RodgerB  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 66
  • View blog
  • Posts: 2,284
  • Joined: 21-September 07

Re: Serverless LAN Chat Application Best Practices?

Posted 23 February 2008 - 07:58 PM

Thanks for that, I think I will download a packet sniffer and see how it is working sending messages to other clients. The way I am thinking of it now is just sending messages to every computer in the network, I want mine to be as simple as possible without need for authentification, but this task is becoming quite trivial without a server.

This is the kind of program I am interested in, but I want the gratification of saying I actually programmed it myself rather than using somebody elses client. :)

Thanks for your assistance.

EDIT: Hahaha that was very eventful... lol, it seems the packets it sends are encrypted. I have realised that every minute it sends a packet and recieves a packet, I am assuming this is a ping packet, both requesting and acknoledging it, but of course it was sending to itself.

I haven't done any further indepth testing, but it does send the chat packet to itself when the user sends a message. Interesting...

This post has been edited by RodgerB: 24 February 2008 - 12:05 AM

Was This Post Helpful? 0
  • +
  • -

#4 farhan1987  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 05-July 08

Re: Serverless LAN Chat Application Best Practices?

Posted 05 July 2008 - 07:01 AM

thax
Was This Post Helpful? 0
  • +
  • -

#5 kikz  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 32
  • Joined: 21-July 08

Re: Serverless LAN Chat Application Best Practices?

Posted 22 July 2008 - 02:01 PM

Another approach might be to have every "peer" (I was going to say "client", but there's no server, so no client :blink: ) contain a list of all other peers.
When a peer wants to connect to the chat it needs to only find any peer and download the list of all peers (and add its self to that list).

As P2P involves each peer being both a client and a server, I'd advise against using the simplistic TcpClient class. Use the Socket class instead, and use async comms to get better performance. Socket is a lower level that TcpClient, so will involve a steeper learning curve, but you'll get better results.

Simplistically, when a peer has a message to send, it sends to every connected peer. Once you get that working, it would be good to look at making the application more scalable by having the peer only connected to a smaller group of peers, once of which connects to another peer in a smaller group. This would get around the issue of having only limited ports available.
Was This Post Helpful? 0
  • +
  • -

#6 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Serverless LAN Chat Application Best Practices?

Posted 31 July 2008 - 12:12 AM

I believe the way you do this is UDP on a broadcast IP. At least that would be the classic way to do this. Programs such as network messengers work this way. There are an irritating number of such chat programs (and I am sorry to hear that you feel the need to make the world one more) and these programs are particularly irritating. You can find any number of open source versions. This also seems to be a common C# topic in forums.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1