Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Samples for cAsyncSocket.cls #18

Open
dragokas opened this issue Jun 6, 2021 · 1 comment
Open

Samples for cAsyncSocket.cls #18

dragokas opened this issue Jun 6, 2021 · 1 comment

Comments

@dragokas
Copy link

dragokas commented Jun 6, 2021

Hi,
Can I ask you please to help me with ports leaking?

I prepared and attached another one simple samples (based on your chat samples and my previous forms #7 ), you may want (or may not) include them as samples in your project in the future.

This time without controls at all.
I moved the operational part to separate classes to minimize code size in the main form module.

There are 3 projects:

  1. Client
  2. Server
  3. Client-Server (same as 1 + 2, merged together).

If you try to send several packets (using project # 3, or bunch of # 1 + # 2), you will see, that ports are get occupied with status "Time Wait", which is automatically free by system after ~ 120 sec. However, those should have been instantly free with Socket.Close_ method. Why it doesn't want to?

Thanks a lot for your help.

leak

Attachment: https://dragokas.com/temp/Socket-samples.zip (can't attach for some reason).

@wqweto
Copy link
Owner

wqweto commented Jun 6, 2021

Remaining TIME_WAIT is normal. Check out this console session

C:\Users\wqw>nslookup rusradio.ru 8.8.8.8
Server:  dns.google
Address:  8.8.8.8

Non-authoritative answer:
Name:    rusradio.ru
Address:  31.184.225.242

C:\Users\wqw>netstat -ano | findstr -i 31.184.225.242

C:\Users\wqw>curl http://rusradio.ru -o nul
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   194  100   194    0     0    194      0  0:00:01 --:--:--  0:00:01  1243

C:\Users\wqw>netstat -ano | findstr -i 31.184.225.242
  TCP    172.17.17.104:31737    31.184.225.242:80      TIME_WAIT       0

C:\Users\wqw>netstat -ano | findstr -i 31.184.225.242
  TCP    172.17.17.104:31737    31.184.225.242:80      TIME_WAIT       0

C:\Users\wqw>netstat -ano | findstr -i 31.184.225.242
  TCP    172.17.17.104:31737    31.184.225.242:80      TIME_WAIT       0

C:\Users\wqw>netstat -ano | findstr -i 31.184.225.242
  TCP    172.17.17.104:31737    31.184.225.242:80      TIME_WAIT       0

C:\Users\wqw>netstat -ano | findstr -i 31.184.225.242

C:\Users\wqw>

On Win10 the TIME_WAIT state past closing the socket remains for ~30 seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants