Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. sockets in MFC

sockets in MFC

Scheduled Pinned Locked Moved C / C++ / MFC
sysadminc++cssquestionlounge
28 Posts 6 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H hrishiS

    here is one more doubt of me. How can we broadcast a message actually using MFC socket programing. Is it a for loop and send to each one. Or any syntax is there to broadcast a message to all in a network or may be a set of IP address. I am a beginner

    N Offline
    N Offline
    Nishad S
    wrote on last edited by
    #19

    That is something with Datagram Sockets...

    - ns ami -

    1 Reply Last reply
    0
    • C Code o mat

      I think you can but i have never worked with access so i can't help you with it. Plan your chat-protocol carefully, remember that your clients will probably need to be notified of certain events like someone going offline or coming online...

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

      H Offline
      H Offline
      hrishiS
      wrote on last edited by
      #20

      oh ya that could be also one more problem. I haven't thought about it only. But I guess we can broadcast a special message(going offline) to all. Instead of events notifications. Am I correct? I am a beginner

      C 1 Reply Last reply
      0
      • H hrishiS

        A sincere thanks for your reply Got lots idea from you.Specially the steps i should follow. it sounds very professional.

        VuNic wrote:

        You can directly use winsock2.

        what is winsock2? is it for MFC? is there any advantage on normal socket functions like listen/bind/createsocket etc (which I have worked on little bit). I am a beginner

        modified on Monday, March 9, 2009 9:34 AM

        E Offline
        E Offline
        Eytukan
        wrote on last edited by
        #21

        himangshuS wrote:

        what is winsock2? is it for MFC? is there any advantage on normal socket functions like listen/bind/createsocket etc (which I have worked on little bit).

        lol. winsock is called - normal sockets. MFC just wraps around. You will get better understanding if you go for winsock API. I don't force you to leave MFC, but that's not my choice when it comes to sockets. Nishant Shivakumar has a neatly written TCP client server application. I'd recommend you to start with that. wait let me check it.

        He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

        1 Reply Last reply
        0
        • H hrishiS

          A sincere thanks for your reply Got lots idea from you.Specially the steps i should follow. it sounds very professional.

          VuNic wrote:

          You can directly use winsock2.

          what is winsock2? is it for MFC? is there any advantage on normal socket functions like listen/bind/createsocket etc (which I have worked on little bit). I am a beginner

          modified on Monday, March 9, 2009 9:34 AM

          E Offline
          E Offline
          Eytukan
          wrote on last edited by
          #22

          Clikt[^]

          He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

          H 1 Reply Last reply
          0
          • S SandipG

            This article Chat Client/Server[^] might help you to get started.

            Regards, Sandip.

            E Offline
            E Offline
            Eytukan
            wrote on last edited by
            #23

            lol the author of that article has taken screen shots of those widows with his junk desktop on the background!

            He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

            1 Reply Last reply
            0
            • H hrishiS

              oh ya that could be also one more problem. I haven't thought about it only. But I guess we can broadcast a special message(going offline) to all. Instead of events notifications. Am I correct? I am a beginner

              C Offline
              C Offline
              Code o mat
              wrote on last edited by
              #24

              How would you broadcast that?

              > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Life: great graphics, but the gameplay sux. <

              1 Reply Last reply
              0
              • E Eytukan

                Clikt[^]

                He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

                H Offline
                H Offline
                hrishiS
                wrote on last edited by
                #25

                thnaks could you please tell me if my design is correct. server ->Maintains a list of Ip_Address-user. Always in listen mode, so that if someone ask for the list it sends it. -> If the admin adds a new user, he will re-send the list to all (but I am not sure, how to do it,when if the clients are busy sending message. should i restart all or do something) client -> on boot/application start, it request server and get the list(His IP-username should be present in the list). And sends a message that he is online to all. ->if he goes offline- he will notify everyone and the go offline. so basically only those people who are listed in the server by admin can only chat

                E 1 Reply Last reply
                0
                • H hrishiS

                  thnaks could you please tell me if my design is correct. server ->Maintains a list of Ip_Address-user. Always in listen mode, so that if someone ask for the list it sends it. -> If the admin adds a new user, he will re-send the list to all (but I am not sure, how to do it,when if the clients are busy sending message. should i restart all or do something) client -> on boot/application start, it request server and get the list(His IP-username should be present in the list). And sends a message that he is online to all. ->if he goes offline- he will notify everyone and the go offline. so basically only those people who are listed in the server by admin can only chat

                  E Offline
                  E Offline
                  Eytukan
                  wrote on last edited by
                  #26

                  Your questions are at times too open & wide. :sigh: Try with simple implementation, once you get the picture you can design your complete application.

                  He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus

                  1 Reply Last reply
                  0
                  • H hrishiS

                    Hi to All, First of all thanks to all for replies to my previous post. I am going to do an simple chat application on a network(LAN).Using MFC.I wanted an advice whether to do it as dialog based, SDI or MDI? The application should be more or less the same as GTalk Please advice for both client and server. Thanks in Advance I am a beginner

                    S Offline
                    S Offline
                    ShiXiangYang
                    wrote on last edited by
                    #27

                    I have just write some code for your question. I hope it will give you any help.But I cannt submit one article. Can you tell me your E-mail? I will send to you.

                    modified on Tuesday, March 10, 2009 3:30 AM

                    H 1 Reply Last reply
                    0
                    • S ShiXiangYang

                      I have just write some code for your question. I hope it will give you any help.But I cannt submit one article. Can you tell me your E-mail? I will send to you.

                      modified on Tuesday, March 10, 2009 3:30 AM

                      H Offline
                      H Offline
                      hrishiS
                      wrote on last edited by
                      #28

                      oh thanks a lot.... himangshu_802@yahoo.co.in I am a beginner

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups