Sample KalturaClientTester not working for me.

RichardStarr
RichardStarr Los Angeles,CAMember Posts: 9

Hi, I'm new to Kaluta, please bear with me.

I work for a company that has been using Kaltura for a while.

They wanted to update an upload process which was failing due to size issues.

I found a sample code of c# on the site.

github.com/kaltura/KalturaGeneratedAPIClientsCsharp

I removed most of the code in the "main" section leaving only the following.


 uniqueTag = Guid.NewGuid().ToString().Replace("-", "").Substring(0, 20);

 Console.WriteLine("Starting C# Kaltura API Client Library");

   BaseTest tester;

    tester = new SampleThreadedChunkUploadTest();

     tests.Add(tester.getId());

     tester.test();

      while (tests.Count > 0)

      {

        Thread.Sleep(100);

      }

      Console.WriteLine("Done. Exit code was "+code);

      Environment.Exit(code);


I updated the following constants to match what we have in the working app.

(Obviously not going to post the values)

    //private const int PARTNER_ID = @[email protected]; //enter your partner id

    //private const string ADMIN_SECRET = "@[email protected]";

    //private const string SERVICE_URL = "@[email protected]";

//  private const string USER_ID = "00000";

--------------

I also modified MultiRequestBuilder.cs

Adding a response == null check because I was getting null responses.

 public override void OnComplete(object response, Exception error)

    {

      if (response == null)

      {

        List<object> responses = (List<object>)response;

        for (int i = 0; i < responses.Count; i++)

        {

          if (responses[i] is APIException)

          {

            requests[i].OnComplete(null, (APIException)responses[i]);

          }

          else

          {

            requests[i].OnComplete(responses[i], null);

          }

        }


        base.OnComplete(response, error);

      }

    }

-----

I end up with the following.

[00001] > url : [https://www.kaltura.com//api_v3/service/uploadtoken/action/add]

[00001] > full request data: [{"apiVersion":"17.12.0","clientTag":"dotnet:21-11-09","format":1,"kalsig":"d009afae828531909f3f99053cef93ff","ks":"djJ8Mjc2NTR8188w4pNkwntQb6xSMsYekNWtyyts37wCPFe2kyvpEQazX0ZLua58SNP21SxMAzKN5WTdenuZu8WaR3SHTAVdRg==","uploadToken":{"fileName":"DemoVideo.flv","fileSize":512919,"objectType":"KalturaUploadToken"}}]

[00002] > url : [https://www.kaltura.com//api_v3/service/media/action/add]

[00002] > full request data: [{"apiVersion":"17.12.0","clientTag":"dotnet:21-11-09","entry":{"mediaType":1,"name":"C# Media Entry Uploaded in chunks using threads","objectType":"KalturaMediaEntry"},"format":1,"kalsig":"0d087672e3ef5ba235c8045c1afd695f","ks":"djJ8Mjc2NTR8188w4pNkwntQb6xSMsYekNWtyyts37wCPFe2kyvpEQazX0ZLua58SNP21SxMAzKN5WTdenuZu8WaR3SHTAVdRg=="}]

[00002] > Error General Exception occored during request, ex:System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

  at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)

  at System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)

  --- End of inner exception stack trace ---

  at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)

  at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)

  --- End of inner exception stack trace ---

  at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)

  at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)

  --- End of inner exception stack trace ---

  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

  at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

  at Kaltura.Request.BaseRequestBuilder`1.<ExecuteAsync>d__22.MoveNext()

[00001] > Error General Exception occored during request, ex:System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

  at System.Net.Sockets.Socket.BeginReceive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)

  at System.Net.Sockets.NetworkStream.BeginRead(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)

  --- End of inner exception stack trace ---

  at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)

  at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)

  --- End of inner exception stack trace ---

  at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult, TransportContext& context)

  at System.Net.Http.HttpClientHandler.GetRequestStreamCallback(IAsyncResult ar)

  --- End of inner exception stack trace ---

  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)

  at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

  at Kaltura.Request.BaseRequestBuilder`1.<ExecuteAsync>d__22.MoveNext()

ERROR: Failed chunk upload: An error occurred while sending the request.

ERROR: Failed chunk upload: An error occurred while sending the request.

Done. Exit code was -1


C:\Users\starrr\source\repos\Kaltura\KalturaGeneratedAPIClientsCsharp-master\KalturaClientTester\bin\Debug\net45\KalturaClientTester.exe (process 63976) exited with code -1.

To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.

Press any key to close this window . . .

----

So, any hints as to what the heck I'm doing wrong.

The thing is, I did some tests on a version of this code before and I could have sworn I was able to upload the test file. I wanted to try a larger file, but it failed and when I went back to the test file again it also failed.

Any help would be greatly appreciated.

Tagged:

Answers

This Month's Leaders