SoapExtensions, DIME Attachment and Pipes

Discussion in 'ASP .Net Web Services' started by Oleg, Sep 30, 2003.

  1. Oleg

    Oleg Guest

    Does anybody know a good C# replacement for
    java.io.PipedInputStream, PipedOutputStream?

    The reason I'm asking is sometimes I need transfer really
    amount of huge data (DataSet) using web services.
    At the same time this data can be compressed up to 50
    times using #ZipLib library.
    I have tried SoapExtension & DIME Attachment methods.
    They both work pretty well, except consuming too much
    memory on both client and server sides.

    I currently use this approach (DIME Attachment):
    1. Create DataSet and populate it with data.
    2. Create compressed memory stream [gzipStream = new
    GZipOutputStream(new MemoryStream(1024))] (i.e.
    MemoryStream "decorated by" GZipOutputStream)
    2. Serialize the DataSet into the stream [ds.WriteXml
    (gzipStream)]
    3. Use gzipStream as input stream for DimeAttachment
    [DimeAttachment dimeAttachment = new DimeAttachment
    ("application/x-gzip",
    TypeFormatEnum.MediaType,
    memoryStream)]

    I'm not sure about implementation of dimeAttachment, but
    I hope it writes data
    from dimeAttachment stream directly (i.e. without
    buffering whole stream in memory!) and asynchronously
    into "network stream".

    Things are much worse with SoapExtension...
    (I can describe if somebody really interested :)

    But if we can use PipedInputStream, PipedOutputStream it
    will work like this:
    1. Got populated DataSet.
    2. Create connected PipedOutputStream & PipedInputStream.
    3. Create new thread (T) and give it DataSet &
    PipedOutputStream
    4. When thread (T) runs, it starts writing DataSet into
    PipedOutputStream "decorated" by GZipOutputStream.
    5. Use PipedInputStream as input stream for DimeAttachment

    The difference with previous scenario is that
    we never have whole serialized & zipped DataSet in memory.
    Instead we have only small part of it hold in a buffer
    used by piped streams.
    PipedOutputStream.write call will block when the buffer
    is full.
    PipedInputStream.read call will block when the buffer is
    empty.

    So, does anybody know a good C# replacement for
    java.io.PipedInputStream, PipedOutputStream? :)
    Sincerely,
    Oleg

    P.S. I know what asynchronous IO is. I.e. I think I
    know! :)
    Oleg, Sep 30, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ipsita
    Replies:
    3
    Views:
    3,101
    Scott Mitchell [MVP]
    Oct 29, 2004
  2. Ipsita
    Replies:
    1
    Views:
    3,254
    bruce barker
    Oct 29, 2004
  3. David Dundua

    Referenced DIME attachment

    David Dundua, Jul 23, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    110
    David Dundua
    Jul 23, 2003
  4. Senthil

    DIME Attachment from Client to Server

    Senthil, Oct 6, 2003, in forum: ASP .Net Web Services
    Replies:
    2
    Views:
    263
    Scott McFadden
    Oct 8, 2003
  5. Ipsita

    How to send a DIME attachment with SOAP

    Ipsita, Oct 29, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    363
    Dan Rogers
    Nov 16, 2004
Loading...

Share This Page