please help with client server program in MFC
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Thread: please help with client server program in MFC

  1. #1
    Join Date
    Mar 2012
    Posts
    99

    please help with client server program in MFC

    I need to create a TCP/IP program using visual studios MFC that displays all client's IP addresses that are connected to the client.
    The MFC application just has a list box and a button. The client can be a simple console application.
    When the button is clicked, the list box gets populated with all ip addresses of connected clients.

    This is probably really simple for anyone who knows how to do it but i have never used MFC before and i can't find any basic tutorials/source code

    please help me with this
    Last edited by beginner91; March 12th, 2013 at 09:07 AM.

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,294

    Re: please help with client server program in MFC

    Well, what you need is an MFC CAsyncSocket class.
    You could also look at this essay about MFC Asynchronous Socket Example
    Note that for your current task you will need only a small part of this example (and only its server part)
    Victor Nijegorodov

  3. #3
    Join Date
    Mar 2012
    Posts
    99

    Re: please help with client server program in MFC

    sorry that essay didn't really help

  4. #4
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,294

    Re: please help with client server program in MFC

    Quote Originally Posted by beginner91 View Post
    sorry that essay didn't really help
    And what did you mean under "really help"?
    Did you implement this code? Did you test it? Have you understood how it works?
    Did you read about CAsyncSocket class in MSDN?
    Victor Nijegorodov

  5. #5
    Join Date
    Mar 2012
    Posts
    99

    Re: please help with client server program in MFC

    no i did not implement this code because this example is not what i want my program to do

  6. #6
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,294

    Re: please help with client server program in MFC

    Quote Originally Posted by beginner91 View Post
    no i did not implement this code because this example is not what i want my program to do
    But it does exactly what you asked in your thread subject: "... client server program in MFC"

    Besides, like I wrote you:
    Quote Originally Posted by VictorN View Post
    Note that for your current task you will need only a small part of this example (and only its server part)
    Victor Nijegorodov

  7. #7
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,055

    Re: please help with client server program in MFC

    Quote Originally Posted by beginner91 View Post
    no i did not implement this code because this example is not what i want my program to do
    Sometimes you have to take other code that may be similar and adapt it to your own use. Hoping to find already written code that does exactly what you want isn't a reasonable expectation. If you've never used MFC before, you may want to work through a book or tutorial to get up to speed on it as Windows programming, even with MFC is a pretty complex subject.

  8. #8
    Join Date
    Mar 2012
    Posts
    99

    Re: please help with client server program in MFC

    the problem is i can't find any basic tutorials. listing the ip addresses of connected clients is not complicated but i know i need to learn the basics before i can do it

  9. #9
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,055

    Re: please help with client server program in MFC

    Quote Originally Posted by beginner91 View Post
    the problem is i can't find any basic tutorials. listing the ip addresses of connected clients is not complicated but i know i need to learn the basics before i can do it
    http://www.barnesandnoble.com/s/C-mf...rd=C%2B%2B+mfc

  10. #10
    Join Date
    Mar 2012
    Posts
    99

    Re: please help with client server program in MFC

    is there no good tutorials online?

  11. #11
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Posts
    12,055

    Re: please help with client server program in MFC

    Quote Originally Posted by beginner91 View Post
    is there no good tutorials online?
    I think you're underestimating just how much you need to learn. These books are 1,000 pages or more for a reason. You can't learn this stuff from spending a few minutes reading a couple of web pages.

  12. #12
    Join Date
    Mar 2012
    Posts
    99

    Re: please help with client server program in MFC

    i have to make this one program using mfc then i will probably never use it again...
    i'm not wasting money on books thats why i am looking for tutorials online

  13. #13
    Join Date
    Mar 2012
    Posts
    99

    Re: please help with client server program in MFC

    i have to make this one program using mfc then i will probably never use it again...
    i'm not wasting money on books thats why i am looking for tutorials online

  14. #14
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    5,928

    Re: please help with client server program in MFC

    Quote Originally Posted by beginner91 View Post
    i have to make this one program using mfc then i will probably never use it again...
    For all the years, any new technique or technology I ever learned by making samples just for self training, or out of curiosity, or for fun only, they all re-appeared later in real projects, in this or that form.

    [/hl]i'm not wasting money on books[/hl] thats why i am looking for tutorials online
    Right. And how good it worked so far?

    BTW, why MFC? MFC is just a framework among others on the market, i.e. just one possible way to implement networking by using a little part of a huge framework, while there might be lots of alternatives like frameworks, libraries, etc., or even no framework at all, just bare Winsock API.

    Is it about some special requirement?

    Quote Originally Posted by beginner91 View Post
    the problem is i can't find any basic tutorials. listing the ip addresses of connected clients is not complicated but i know i need to learn the basics before i can do it
    The problem is that there's nothing basic in networking with MFC. You need to learn the real basics of networking out of MFC. You need to learn MFC itself out of networking. Then you combine the two and make something useful. Lots of work, you know. I really doubt you can find such simple and consistent tutorial that would guide you through all this.
    Best regards,
    Igor

  15. #15
    Join Date
    Mar 2012
    Posts
    99

    Re: please help with client server program in MFC

    actually i found some really good source code from this website: http://www.softwareandfinance.com/Vi...nt_Server.html

    its code for a basic client server program. the client can send messages (strings) to the server. the server receives the message and also displays the date, time, ip address and port number of the client in a text box.

    but like i said in the first post i would like to change this program so that there is a button and a listbox for the server. the button searches for clients and if the server finds any clients, the clients ip address get displayed in the listbox. also the client doesn't need to be able to send messages. just maybe receive a message when it connects to the server.

    can anyone help me change the code?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center