Welcome, Register for free! or Login below:
EduGeek.net RSS Feeds Register FAQ Members Social Groups User Map Calendar Search Today's Posts Mark Forums Read

Go Back   EduGeek.net Forums > Coding and Web Development > Coding
Reply
 
LinkBack Thread Tools Search Thread Language
Sponsored Links
Old 21-11-2008, 03:59 AM   #1
 
Dyroxide's Avatar
 
Join Date: Nov 2008
Location: Ohio
Posts: 1
usa us ohio
Thanks: 2
Thanked 0 Times in 0 Posts
Rep Power: 0 Dyroxide is an unknown quantity at this point
Default Visual Basic 2008 LAN Chat Room

I am currently a student at Sentinel Career Center's CCNT program (Computer Communications Network Technician). I was hoping to get some help making a simple chat room using visual basic from scratch. It has previously been suggested to me that I should use c4f p2p toolkit to do this. What fun is that though? I want to make it without outside programs but i havn't a clue how to make the chat room run in my classes LAN. No, I am not using this for evil, netsend in our class is not disabled (this was from another post I saw earlier I just wanted to clarify this). I want a simple program to display usernames and messages next to them that say 3 people viewing my program could read.

could you please give me some general direction as to what things i will need to look up to make this work.

I'm not looking for someone to write the code for me just to tell me what I would need to research and put the code together.

here is a simple layout of the program when it is run (what I hope it will be like)
__________________________________________________
[chat room - [] x ]
|user 1: hello |
|user 2: how are you user 1 and user 3? |
|user 3: i'm ok its a good thing they helped you on |
| edugeek.net forums |
|user 1: yea. |
| |
| |
| |
|________________________________________________|
| [Send] |
|________________________________________________|

Something to that effect.. i hope it doesnt make all that spaced out and ruined that took me a decent amount of time to draw out :\

anyways I would appreciate any direction that you can give me, and please i dont want any downloads i want to code this myself i just need general direction on what i would need to do to make this work.
  Reply With Quote
Old 21-11-2008, 10:11 AM   #2
 
Friez's Avatar
 
Join Date: Dec 2006
Posts: 778
uk uk england
Thanks: 13
Thanked 13 Times in 12 Posts
Rep Power: 11 Friez has a spectacular aura aboutFriez has a spectacular aura about
Default

I'm not that hot on VB, but I code C/C++/C#/Perl/PHP/ASM
I'll go over the design/theory of the thing (applies to whatever language you may be using), but I won't list source codes (else I may as well be handing over a copy of mIRC).

Firstly, you need to read up on SOCKETS. If it's a windows app, winsock should be right up your street. Sockets are what allow you to do the raw networking stuff.

There are two types of sockets: Blocking and Non-Blocking. A blocking socket will sit and wait for data to recv() or send(), whereas non-blocking sockets use select() in order to see if theres data to be written/read and does so asynchronously.

There's tutorials on the web for this sort of thing, go google.

You need to decide what sort of sockets to use in your program.

Additionally, You will want to consider how your app is going to function. Is it peer-to-peer, or is it client-server model? The easiest model to code for conceptually is client-server. At any rate, your network code will be shaped around your design decisions at this stage.

If you choose the client-server model you will need to consider making two applications (obviously). The server will need to handle multiple connections (often simultaneously).

Thus, a blocking socket would be insufficient. (For example: Server waits infinitely for a line of text from client A, client B sends some text, but server is still waiting for client A, so nobody gets an update until client A talks).

To do this you need to do one of the following:
Use Select() and non-blocking sockets.
Use Multithreading (pthreads or microsoft threads) to spawn a 'worker thread' to handle that client exclusively (using a blocking socket), the thread provides "simultaneous" processing power as to prevent the other users from being blocked. Threads of course require you to be careful with design to ensure you don't end up causing deadlock or causing issues (resources are shared in the program, so writing to a variable not intended exclusively for a thread will change for ALL other threads, causing inconsistency if it's not policed).

Now that you know what sort of tech you're looking at, you now need to design your app. Yes, design. At the least, make a finite state machine for your program(s) designing what states your program can get into.

You will also need to design your networking protocol. It's quite likely you'll use TCP/IP for this (UDP is unreliable, but faster/less overhead, chances are you'll want the reliability of TCP for an app like this since it is quite lightweight, unlike a game).

Ontop of that layer of the OSI model (go google) you'll be writing your own protocol. This is to handle the message interaction between client-server and server-client. E.g.

Client sends message like so:
[0][USERNAME] - the first byte (0) indicates user is logging in/renaming to subsequent bytes in [USERNAME]
[1][MESSAGE] - the first byte (1) indicates user is sending a message to everyone in the chat
[2][USERNAME][1][MESSAGE] - the first byte (2) indicates the user is sending a whisper to a user. The username is specified up to the binary value of 0x1, and then the message is listed up to the end of transmission.

As you can see, you need to put a lot of thought and design into this, plus have a decent understanding of network programming.

Topics for you to research:
  • Finite State Machines
  • OSI Model
  • Sockets / Winsock
  • Multi Threading
  • TCP/UDP

Good luck!

Last edited by Friez; 21-11-2008 at 10:17 AM..
  Reply With Quote
The Following User Says Thank You to Friez For This Useful Post:
Dyroxide (21-11-2008)
Old 21-11-2008, 10:12 AM   #3
 
Scruff's Avatar
 
Join Date: May 2007
Location: Lincs
Posts: 112
Thanks: 2
Thanked 1 Time in 1 Post
Rep Power: 0 Scruff is an unknown quantity at this point
Default

I would suggest the first thing you need to look into is the System.Net.Sockets namespace for communicating over TCP

Here is a link to the msdn article to get you going - MSDN
  Reply With Quote
The Following User Says Thank You to Scruff For This Useful Post:
Dyroxide (21-11-2008)
Reply

Register now for FREE and post messages!


Username: Password: Confirm Password: E-Mail: Confirm E-Mail:
Birthday:      
Image Verification
  I agree to forum rules 

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Basic - LAN Message Program - Help JavaNocKziK Coding 22 24-09-2008 01:32 PM
Visual Basic 6 and administrative priveleges googlemad Windows 0 05-02-2008 12:06 PM
Video Chat / web chat over LAN johnkay21 Windows 10 05-10-2007 07:52 AM
Visual Basic 6 Samson Windows 4 30-08-2007 12:41 PM
Visual basic 6 Halfmad Windows 9 11-06-2007 02:57 PM



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search Thread
Search Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 08:49 PM.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Copyright EduGeek.net