lundi 20 avril 2015

How to send long data Using NamedPipes c#?

Vote count: 0

Im Trying to send an image to another pc using namedpipes we are using this code:

byte[] DataToBeSend;

    NamedPipeClientStream PipeClient =
    new NamedPipeClientStream(_Nombre, _Pipe,
    PipeAccessRights.FullControl, PipeOptions.None,                      TokenImpersonationLevel.None,
    HandleInheritability.None);
    DataToBeSend = BitConverter.GetBytes(_Dato.Length);
    int HL = _Dato.Length;
    int Longitud = BitConverter.ToInt32(_Dato, 0);
    PipeClient.Connect();
    Console.WriteLine("Conected");
    PipeClient.Write(DataToBeSend, 0, DataToBeSend.Length);
    PipeClient.WaitForPipeDrain();
    PipeClient.Write(_Dato, 0,HL);
    PipeClient.WaitForPipeDrain();
    PipeClient.Close();

Firts I send the length of the buffer and then the buffer ( who contains the image on bytes) the problem is that that image is 100 MB and a named pipe cant send such as big infomation , what is the best form to solve this problem? there is a metod able to convert this buffer in a smaller one!

asked 1 min ago



How to send long data Using NamedPipes c#?

Aucun commentaire:

Enregistrer un commentaire