Solved

Chat Software to be deveoped in VC++ within one week

Posted on 2004-04-06
8
176 Views
Last Modified: 2010-04-01
Hi all,

I know c, c++ and vc++,
Since I just have developed only one standalone project in vc++, so dont have any enterpirse development in VC++. I have been given a task to deveop an example chat software to check my picking abilities. The problem is that I will have to deveop that in 'JUST' one week using sockets and mutithreading. The software will not be very complex

So I want to know the "complete and detailed procedure" to follow for deveoping that in one week at any cost. For instance I want to know , should I create MDI or SDI or dialog based, what , what and what tools and methods will I have to use. I need complete sequence of steps to follow.

Note: I am not asking for code or project to be made by anyone else.  I must develop that.

Regards.
0
Comment
Question by:VirtualEye
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 

Author Comment

by:VirtualEye
ID: 10764732
I also want to tell that the edition of vc++ will be 6.0 with MFC.
0
 
LVL 22

Expert Comment

by:grg99
ID: 10764888
One week is rather short deadline.  Do you know a lot about threads and socket programming? You can easily burn up a week just learning the basics of each of these subjects.

Some of the basic things you need:

Some way for each end to know about the existence of the other end, such as ask for the DNS name of the other end.

open a socket to listen for connections.

Open a connection from the other end to that socket.

Sed some sort of introductory handshake, passing info as needed, such as the name of that user,
any validations, etc.

Ask the user to type a line.

Pass back and forth the packets of text.

Display the text in a window.

... Thats basically it.


0
 
LVL 15

Expert Comment

by:lakshman_ce
ID: 10766251
0
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 300 total points
ID: 10767893
With VC there are sample chat programs 'Chat Client' and 'Chat Server' that probably would meet your request. Writing your own program is a job that would require months if you still have to gain the basics.

If you couldn't get/use these samples, you may go on like this:

1. Create a dialog-based MFC application - using Application Wizard - and call it Chat.
2. Change Settings-C++-Code-Generation to Multithreaded-Debugging /Win32 Debug)
    resp. MultiThreaded (Win32 Release)
3. Add Wsock32.lib to Settings-LINK-Input-Object/Library Modules
4. Design a Chat Dialog using the Resource Editor where you have two multi-line Edit Fields,
    one to show messages you got and one to edit your own messages.
5. Make both fields vertical scrolling and check 'Want Return" option. First field should be read-only.
6. Create member variables for both edit fields.
7. Create two threads using beginthread(...) in CChatDlg::OnInitDialog
     - First uses       static void CChatDlg::ServerThread(void* pDlg) as start function
     - Second uses   static void CChatDlg::ClientThread(void* pDlg) as start function    
8. You have to declare both static member functions in your dialog class.
9. The void* argument to pass is 'this' - the dialog pointer, e. g.
    beginthread(CChatDlg::ServerThread, 0, this);
10. Implement ServerThread() by
     - including <winsock2.h>
     - create a socket
     - get a unique port number (any instance of the chat app must use an own - wellknown port no)
     - bind() port to socket
     - listen() to the socket for incoming requests
     - accept() incoming clients (you create a new socket when accepting)
     - create a new Client Thread and pass the socket via pDlg member
     - wait for new clients
11. Implement ClientThread by
     - including <winsock2.h>
     - check pDlg if there is a connected socket where to read messages from
     - if yes,
          - read messages from socket and send them to pDlg. exit thread if connection dies.
          - check pDlg if there are messages to send          
     - if no,
        - create a socket
        - try to connect to the server IP address (or name) and port different from own server
          IP and port. If success, create a new ClientThread and pass the current socket via pDlg member
        - try next known server - if any
12. Implement dialog by writing a handler for incoming messages.
      These messages get added to the first edit field.
13. Implement OnOK() by reading text from second edit field and send this text to all client threads
      that are successfully connected. Add a client name/id to each message.

Tell me, if you need further advice (or tools).

Regards, Alex


     
0
 

Author Comment

by:VirtualEye
ID: 10789472
Thanx for Response, I will try check your advices.
Regards.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question