CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2005
    Posts
    42

    linux C/C++ pipes programming

    Hi everyone,

    This is my first post in these forums so welcome everybody.

    I don't know if what i want is by any means possible. Here's the whole deal. I am writting a plugin for another program, and for that plugin to work correctly i needed to be able to receive some data from another app. So basically what i wanted to achieve is to call some other app from my plugin and then get data back into my process.

    Do you think this is possible? is the only/best way to use temp files?

    Thanks in advance for all your time and help.

    Cheers,

    Alex Paes

  2. #2
    Join Date
    Nov 2004
    Location
    Virginia, The lovers' state
    Posts
    64

    Re: linux C/C++ pipes programming

    Quote Originally Posted by AlexPaes
    Do you think this is possible? is the only/best way to use temp files?
    nope, you can use the BSD Sockets and communicate via TCP. TCP/IP requests made on the loopback interface (local machine) are as fast, if not faster than writing to a file.

    Welcome aboard...

  3. #3
    Join Date
    Feb 2005
    Posts
    42

    Re: linux C/C++ pipes programming

    Thanks for such a fast reply,

    I neved did that kind of stuff, maybe you can point me some nice places where i can look for more information on how i can implement that?

    Thanks,

    Alex Paes

  4. #4
    Join Date
    Nov 2004
    Location
    Virginia, The lovers' state
    Posts
    64

    Re: linux C/C++ pipes programming


  5. #5
    Join Date
    Feb 2005
    Posts
    42

    Re: linux C/C++ pipes programming

    Hi,

    Thanks a lot for your help, i have gathered quite some material. Now, on to study...

    cheers,

    AlexPaes

  6. #6
    Join Date
    Apr 2004
    Posts
    55

    Exclamation Re: linux C/C++ pipes programming

    Hold on!

    Before you use TCP/IP, you might want to look into some system calls for setting up a pipe.

    Check out the following system calls:
    int pipe(int fifo[2]);
    dup();
    dup2();
    fcntl();


    The shell uses some of these for redirecting input/output to a process, and you can use the same...

    I don't know which will be easier (these or TCP/IP)

    Try to find more info in the UNIX man pages - man system_call or K->Help->Unix Manual Pages->System Calls.

    If you just want to get the data from the other program, and all at once, temp files may be the easier solution...

  7. #7
    Join Date
    Feb 2005
    Posts
    42

    Re: linux C/C++ pipes programming

    Hi,

    Actually i don't want to pass info all at once and i need to pass the data from one program to another as it becomes available. So i think pipes are not the way to do it, i believe the best way is actually through sockets.

    I just need to get them running

    Btw, is the listen() just a single call or will it keep listening for any period of time? I mean in order to catch incoming connections i believe i will need to get that listen in some while or for cycle, is this right?

    Thanks to all for the help,

    Alex Paes

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