Skip to content

Socket connect opened many times in same machine with same request #1322

Closed
@wyaow

Description

@wyaow

My issue is that when my web browser navigates to these url:
http://localhost:44382/api/Todo/3
http://localhost:44382/api/Todo

With command "netstat -nao | findstr 44382", It shows only one socket connection port opened during the whole time. The same even with more different HTTP Request.
While Use RestClient(Code below), It seems that every HTTP Request Creates a different socket connection port althought it will be released within a few minute.

for (int i = 1; i <= 10; i++)
{
	var client = new RestClient("http://localhost:44382/api/Todo/3");
	var request = new RestRequest();
	equest.Method = Method.GET;
	request.RequestFormat = DataFormat.Json;
	
       var asyncHandle = client.GetAsync<TodoClass>(request, (resp, callback) =>
	{
		Console.WriteLine(resp.Content);	
		callback.Abort();
	});
}

image
image

Is there a best way to avoid create different socket port by use one same socket?
look forward to get your reply !

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions