Horje
WebClient timeout Code Example
WebClient timeout
    private class WebClient : System.Net.WebClient
    {
        public int Timeout { get; set; }

        protected override WebRequest GetWebRequest(Uri uri)
        {
            WebRequest lWebRequest = base.GetWebRequest(uri);
            lWebRequest.Timeout = Timeout;
            ((HttpWebRequest)lWebRequest).ReadWriteTimeout = Timeout;
            return lWebRequest;
        }
    }

    private string GetRequest(string aURL)
    {
        using (var lWebClient = new WebClient())
        {
            lWebClient.Timeout = 600 * 60 * 1000;
            return lWebClient.DownloadString(aURL);
        }
    }
webclient timeout
@Configuration
@EnableWebFlux
public class WebFluxConfig implements WebFluxConfigurer
{  
  Logger logger = LoggerFactory.getLogger(WebFluxConfig.class);
   
  @Bean
  public WebClient getWebClient()
  {
    HttpClient httpClient = HttpClient.create()
            .tcpConfiguration(client ->
            		// Here there are global timeout
                    client.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000)
                    .doOnConnected(conn -> conn
                            .addHandlerLast(new ReadTimeoutHandler(10))
                            .addHandlerLast(new WriteTimeoutHandler(10))));
     
    ClientHttpConnector connector = new ReactorClientHttpConnector(httpClient.wiretap(true));     
 
    return WebClient.builder()
            .baseUrl("http://localhost:3000")
            .clientConnector(connector)
            .defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
            .build();
  }
}




Csharp

Related
unity call function from another script Code Example unity call function from another script Code Example
how to read particular line of file in c# Code Example how to read particular line of file in c# Code Example
unity C# instantiate prefab Code Example unity C# instantiate prefab Code Example
check variable is empty powershell Code Example check variable is empty powershell Code Example
how to make infinite loop in c# Code Example how to make infinite loop in c# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10