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 0 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 Offline
    H Offline
    hrishiS
    wrote on last edited by
    #1

    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

    N E S S 4 Replies 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

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

      I will start with dialog based application... with some pretty custom drawings... ;)

      - ns ami -

      H C 2 Replies Last reply
      0
      • N Nishad S

        I will start with dialog based application... with some pretty custom drawings... ;)

        - ns ami -

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

        thanks for your reply, But what about the server? can that be also dialog based, since there will be many clients. So i was wondering if it has to be an console based application. I am a beginner

        N 1 Reply Last reply
        0
        • N Nishad S

          I will start with dialog based application... with some pretty custom drawings... ;)

          - ns ami -

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

          You could make your server a service.

          > 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. <

          N H 2 Replies Last reply
          0
          • H hrishiS

            thanks for your reply, But what about the server? can that be also dialog based, since there will be many clients. So i was wondering if it has to be an console based application. I am a beginner

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

            Sorry. I am not much experienced in socket programing. But if you are going to create a gtalk like application peer to peer model is enough.

            - ns ami -

            1 Reply Last reply
            0
            • C Code o mat

              You could make your server a service.

              > 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. <

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

              Answered to me? :confused:

              - ns ami -

              H C 2 Replies Last reply
              0
              • N Nishad S

                Answered to me? :confused:

                - ns ami -

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

                thanks for your reply ns ami, And sorry that was for code-o-mate. anyway,do you mean "cleint-client" by "peer to peer" I am a beginner

                N 1 Reply Last reply
                0
                • C Code o mat

                  You could make your server a service.

                  > 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
                  #8

                  Oh ya, that sounds pretty interesting and realistic. But I was thinking that...why do i need a server,can i communicate directly(client to client)? May the server can give a list of information with IP address and username,thats it. Then the clients can talk to each other directly(not through the server). Is that possible? regards, HImangshu S I am a beginner

                  C 1 Reply Last reply
                  0
                  • N Nishad S

                    Answered to me? :confused:

                    - ns ami -

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

                    Whoups, sorry, of course i wanted to answer himangshuS, didn't notice i "mis-clicked". :(

                    > 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. <

                    N 1 Reply Last reply
                    0
                    • H hrishiS

                      Oh ya, that sounds pretty interesting and realistic. But I was thinking that...why do i need a server,can i communicate directly(client to client)? May the server can give a list of information with IP address and username,thats it. Then the clients can talk to each other directly(not through the server). Is that possible? regards, HImangshu S I am a beginner

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

                      Yes, that is possible.

                      > 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 1 Reply Last reply
                      0
                      • H hrishiS

                        thanks for your reply ns ami, And sorry that was for code-o-mate. anyway,do you mean "cleint-client" by "peer to peer" I am a beginner

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

                        himangshuS wrote:

                        anyway,do you mean "cleint-client" by "peer to peer"

                        I am not sure about the terminology. But AFAIK, in peer to peer, server and client will be in the same application. Each application will keep a list of its contacts and at the starting of application it can broadcast or send some messages to each contacts. So that others can know that you are logged in. This is only my fair concepts... :)

                        - ns ami -

                        H 1 Reply Last reply
                        0
                        • C Code o mat

                          Yes, that is possible.

                          > 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
                          #12

                          fine, so i guess i can go ahead a simple client-client design with a limited server application which will send to the client for the IP-username mapping. But, here again i need to maintain some table structure. I am new to MFC. can I use ms access here? I am a beginner

                          C 1 Reply Last reply
                          0
                          • C Code o mat

                            Whoups, sorry, of course i wanted to answer himangshuS, didn't notice i "mis-clicked". :(

                            > 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. <

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

                            Code-o-mat wrote:

                            sorry

                            No problem... :) It was just to inform you...

                            - ns ami -

                            1 Reply Last reply
                            0
                            • N Nishad S

                              himangshuS wrote:

                              anyway,do you mean "cleint-client" by "peer to peer"

                              I am not sure about the terminology. But AFAIK, in peer to peer, server and client will be in the same application. Each application will keep a list of its contacts and at the starting of application it can broadcast or send some messages to each contacts. So that others can know that you are logged in. This is only my fair concepts... :)

                              - ns ami -

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

                              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 1 Reply Last reply
                              0
                              • H hrishiS

                                fine, so i guess i can go ahead a simple client-client design with a limited server application which will send to the client for the IP-username mapping. But, here again i need to maintain some table structure. I am new to MFC. can I use ms access here? I am a beginner

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

                                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 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

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

                                  Let me explain you that one, 1.Do not start with Dialog or Doc/View conversation. First think about implementing your chat/messaging mechanism. I guess you have been coming around MFC sockets. If you ask me, I'm not for it.I did not like to work with it. You can directly use winsock2. 2. Write a simple TCP client server application in console mode. Once you find the application running and you are clear with the idea, make a simple class that takes care of simple functionalities like connecting, sending & accepting messages. 3. First try for single client-server application. When you are comfortable with it you can move to Multi-client application that would involve threading in most cases. 4. Now you are clear with Sending & receiving messages using winsock. 5. For server part, you can ultimately go for windows services implementation, but to start with I do not recommend it. Because as you are a beginner, you will have to trouble shoot a lot of things at first. So just make it a console server. Where you'll be able to view the messages going across. 6. For client, you can have it as Dialog application, but again it's just based on the need. You can even go for SDI if you want to make use of Serialize-Archive functionality of the document. It could be useful when you save down your chat conversation. 7. Did I answer you?

                                  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
                                  • 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
                                    SandipG
                                    wrote on last edited by
                                    #17

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

                                    Regards, Sandip.

                                    E 1 Reply Last reply
                                    0
                                    • E Eytukan

                                      Let me explain you that one, 1.Do not start with Dialog or Doc/View conversation. First think about implementing your chat/messaging mechanism. I guess you have been coming around MFC sockets. If you ask me, I'm not for it.I did not like to work with it. You can directly use winsock2. 2. Write a simple TCP client server application in console mode. Once you find the application running and you are clear with the idea, make a simple class that takes care of simple functionalities like connecting, sending & accepting messages. 3. First try for single client-server application. When you are comfortable with it you can move to Multi-client application that would involve threading in most cases. 4. Now you are clear with Sending & receiving messages using winsock. 5. For server part, you can ultimately go for windows services implementation, but to start with I do not recommend it. Because as you are a beginner, you will have to trouble shoot a lot of things at first. So just make it a console server. Where you'll be able to view the messages going across. 6. For client, you can have it as Dialog application, but again it's just based on the need. You can even go for SDI if you want to make use of Serialize-Archive functionality of the document. It could be useful when you save down your chat conversation. 7. Did I answer you?

                                      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
                                      #18

                                      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 2 Replies Last reply
                                      0
                                      • 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
                                          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