Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.dotnet.languages.csharp > #41094

Re: Timing with TcpClient

From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups microsoft.public.dotnet.languages.csharp
Subject Re: Timing with TcpClient
Date 2022-12-09 16:46 -0500
Organization Aioe.org NNTP Server
Message-ID <tn0abd$8t2$1@gioia.aioe.org> (permalink)
References <20221209133627.b15e4d6417565be924b48cfe@g{oogle}mail.com>

Show all headers | View raw


On 12/9/2022 5:36 AM, Anton Shepelev wrote:
> Hello, all
> (but how many `all' embraces?)!

Probably not many.

> Without error handling, memory management, and other
> irrelevant details, the printing algorithm is:
> 
>     TcpClient     cli;
>     NetworkStream str;
>     byte[]        data;
> 
>     cli  = new TcpClient( host, port );
>     str  = cli.GetStream();
>     data = Encoding.ASCII.GetBytes( text );
> 
>     str.Write( data, 0, data.Length );
>     Thread.Sleep( Delay ); // ???
> 
>     // Some paranoia:
>     str.Close  (); cli.Close  ();
>     str.Dispose(); cli.Dispose();
> 
> The Sleep() call, marked with ??? above, is necessary for
> the last page to be printed in a timely manner.  Wihout this
> delay, the device prints the last page not when the data is
> sent over network, but when the next batch comes in, even an
> hour later!  How is it possible, and what can be the effect
> of a delay before closing the stream?

This all seems rather weird.

Based on the description I would try to send the data
with an extra FormFeed added at the end  and close
immediately and see if that works.

Arne

Back to microsoft.public.dotnet.languages.csharp | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Timing with TcpClient Anton Shepelev <anton.txt@g{oogle}mail.com> - 2022-12-09 13:36 +0300
  Re: Timing with TcpClient Arne Vajhøj <arne@vajhoej.dk> - 2022-12-09 16:46 -0500
    Re: Timing with TcpClient Anton Shepelev <anton.txt@gmail.com> - 2022-12-25 17:18 +0300

csiph-web