CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2013
    Posts
    2

    Two programs communicating locally.

    I came to codeguru just to browse early in my C programming career. I programmed mainly on Linux but I want to move to windows. I'm definitely not the strongest programmer, but I like the challenge sometimes. I'm not looking for COMPLETE answers here, just directions and pointers.

    I want two separate programs to run on windows, very simple programs. These programs will communicate locally back and forth by sending irrelevant (at first) data. I want them to be able to detect and send data back and forth. Looking around, I've decided to use sockets. I am new to sockets ESPECIALLY on windows. Can anyone point me to a good tutorial or give me some info to look at that would help me in this programming endeavor.

    I have been following these forums for a few months now. This is my first post, so I may have messed up somewhere, but this community seems great. Thanks guys!

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Two programs communicating locally.

    Well, sockets are good for IPC but using them to communicate locally (on the same PC) would be an overhead.
    Perhaps simple posting/sending user defined messages with PostMessage/SendMessage will be easier to implement?
    Or using WM_COPYDATA message?
    Another possibility is using File Mapping. Or just a Clipboard...

    Have a look at:
    MSDN: Interprocess Communications
    Using WM_COPYDATA
    An MFC Asynchronous Socket Example Done Right
    Victor Nijegorodov

  3. #3
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Two programs communicating locally.

    I would be looking at using pipes? These are quite easy to set up and use for IPC.

    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4
    Join Date
    Apr 2013
    Posts
    2

    Re: Two programs communicating locally.

    Yeah, I want to do it with sockets as I may and probably will expand. The references link will help a great deal. If you guys have any pointers or further references, please let me know!

  5. #5
    2kaud's Avatar
    2kaud is online now Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,822

    Re: Two programs communicating locally.

    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured