Skip to content

Any idea on how to port this .net 4? #3

Description

@rlweb

I'm trying to re-write this for the .net v4 framework as I need the app to run on Windows Xp. Yes, Xp.

The issue I'm having is with stream.ReadAsync below. Do you know the best alternative?

I tried to using the simple StreamReader but get timeout issues?

ConnectedState.cs 39-58

byte[] buffer = new byte[1024 * 8];
var taskRead = stream.ReadAsync(buffer, 0, buffer.Length, cancelToken);
try
{
    taskRead.Wait(cancelToken);
}
catch (Exception ex)
{
    _logger.Trace(ex, "ConnectedState.Run");
}
if (!cancelToken.IsCancellationRequested)
{
    int bytesRead = taskRead.Result;
    if (bytesRead > 0) // stream has not reached the end yet
    {
        //Console.WriteLine("ReadCallback {0} bytesRead", bytesRead);
        string text = Encoding.UTF8.GetString(buffer, 0, bytesRead);
        text = mRemainingText + text;
        string[] lines = StringSplitter.SplitIntoLines(text, out mRemainingText);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions