Using Pipes - Programmer

This is a discussion on Using Pipes - Programmer ; Hi Everyone. This may be the wrong place to post this, but I don't know where else to put it. I'm looking into using a pipe to send data between two different applications and I was wondering what I have ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Using Pipes

  1. Using Pipes

    Hi Everyone. This may be the wrong place to post this, but I don't
    know where else to put it.

    I'm looking into using a pipe to send data between two different
    applications and I was wondering what I have to do to be able to send a
    non-character message. Can I send an integer through the pipe? An
    array? An object? What would I need to do to be able to write this
    out and read it in on the other side. All examples I've looked at
    simply send strings across.

    Thanks for your help. I realize this is a pretty 'beginner' level
    question but I'm stuck!

    Dave


  2. Re: Using Pipes


    wrote in message
    news:1166487212.517117.63170@73g2000cwn.googlegrou ps.com...
    > Hi Everyone. This may be the wrong place to post this, but I don't
    > know where else to put it.
    >
    > I'm looking into using a pipe to send data between two different
    > applications and I was wondering what I have to do to be able to send a
    > non-character message. Can I send an integer through the pipe? An
    > array? An object? What would I need to do to be able to write this
    > out and read it in on the other side. All examples I've looked at
    > simply send strings across.
    >
    > Thanks for your help. I realize this is a pretty 'beginner' level
    > question but I'm stuck!


    WriteFile() takes a parameter telling how many bytes you want to send.
    Assuming receiving side knows how to interpret the data you send you can
    easily send any type of data that has a meaning on the receiving side.
    For instance, to send and int you could
    WriteFile(... , &intvar, sizeof(int), ...)

    And that's all fine as long as you for instance won't send anything else. If
    you need to send various type of data you have basically four options:
    1. send different data types in a specific application related order, int,
    float, string, int, float, string,....
    2. send as a structure with a header (eg a byte) telling which data type
    (and which purpose) the data has
    3. have named pipe in message mode and have reader interpret data based on
    the message size
    4. encode variable content as a string and send the string

    - Sten



+ Reply to Thread