Frequent error while placing/modfing orders and getting positions using C# dotnet api

manoj1992
Frequent error while placing/modfing orders and getting positions using C# dotnet api
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.. this error is showing
i have attached my log file please read carefully andreply asap
im trading using dotnet api for equity but it is placing all order in cnc while i have already set each and every stock product type as cnc or mis indivisually based on requirement
please reply correctly
  • manoj1992
    this error is showing
    2022-11-02 13:37:08.9986 - ERROR: System.Net.WebException: An error occurred while sending the request.
    ---> System.Net.Http.HttpRequestException: An error occurred while sending the request.
    ---> 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 (10054): An existing connection was forcibly closed by the remote host.
    --- End of inner exception stack trace ---
    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
    at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter adapter, Memory`1 buffer)
    at System.Net.Http.HttpConnection.g__ReadAheadWithZeroByteReadAsync|44_0()
    at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    --- End of inner exception stack trace ---
    at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
    at System.Net.Http.HttpMessageHandlerStage.Send(HttpRequestMessage request, CancellationToken cancellationToken)
    at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    at System.Net.Http.HttpMessageHandlerStage.Send(HttpRequestMessage request, CancellationToken cancellationToken)
    at System.Net.Http.SocketsHttpHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken)
    at System.Net.Http.HttpMessageInvoker.Send(HttpRequestMessage request, CancellationToken cancellationToken)
    at System.Net.Http.HttpClient.Send(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
    at System.Net.HttpWebRequest.SendRequest(Boolean async)
    at System.Net.HttpWebRequest.GetResponse()
    --- End of inner exception stack trace ---

    EXCEPTION: System.Net.WebException: An error occurred while sending the request.
    ---> System.Net.Http.HttpRequestException: An error occurred while sending the request.
    ---> 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 (10054): An existing connection was forcibly closed by the remote host.
    --- End of inner exception stack trace ---
    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
    at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
    at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter adapter, Memory`1 buffer)
    at System.Net.Http.HttpConnection.g__ReadAheadWithZeroByteReadAsync|44_0()
    at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    --- End of inner exception stack trace ---
    at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
    at System.Net.Http.HttpMessageHandlerStage.Send(HttpRequestMessage request, CancellationToken cancellationToken)
    at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
    at System.Net.Http.HttpMessageHandlerStage.Send(HttpRequestMessage request, CancellationToken cancellationToken)
    at System.Net.Http.SocketsHttpHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken)
    at System.Net.Http.HttpMessageInvoker.Send(HttpRequestMessage request, CancellationToken cancellationToken)
    at System.Net.Http.HttpClient.Send(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
    at System.Net.HttpWebRequest.SendRequest(Boolean async)
    at System.Net.HttpWebRequest.GetResponse()
    --- End of inner exception stack trace ---
  • sujith
    This looks like network/ISP/firewall issue. You need to do some trial and error and see.
Sign In or Register to comment.