Skip to content

Add support for streams in a contract #54

@DNikitenko

Description

@DNikitenko

It is not possible now to declare a method returning Stream, e.g.

public interface IComputingService
{
    Stream GetBigFile();
}

In my use case machines need to transmit big index files between each other, and the file size can be up to 4 GB. There is no possibility to create a byte array more than 2GB. Even if it would be possible, it's undesirable to copy the whole file to memory of both sides of a communication channel.

When using WCF, streamed transmission mode can be used to achieve that. Here is an example of NetTcpBinding configuration:

private static Binding GetBinding()
{
    var binding = WcfHelper.GetNetTcpBinding();

    // Expand properties to allow the transfer of bigger files (> 100MB)
    var netTcpBinding = binding as NetTcpBinding;
    if (netTcpBinding != null)
    {
           netTcpBinding.TransferMode = TransferMode.Streamed;
           netTcpBinding.MaxReceivedMessageSize = Configuration.Instance.MaxSizeOfIndexFileInBytes;
    }
    binding.ReceiveTimeout = TimeSpan.FromMinutes(60);
    binding.SendTimeout = TimeSpan.FromMinutes(60);

    return binding;
}

It would be nice to have the same feature in the IpcServiceFramework.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions