mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2003
Posts: 306
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 306
Hello to you all,

I have noticed today this issue, something that i have tried to trace as much as possible.
I did not test previous beta versions!

I have an addon that listens on a port (81)
If i stop the listening and start again, without connecting in the beginning, all is ok.
If something connects to it before i stop it and start it again (in a window of seconds)
my triple portfree check says for the following command:
//echo ai $portfree(81,192.168.2.100) - $portfree(81,0.0.0.0) - $portfree(81)
ai $true - $true - $true

and i get an error on the next line:
* /socklisten: port error (line 1315, script.mrc)

after i get this error i am able to listen on the port again, even in less then one second after.

If i wait like 5 seconds after i stop the port i can start it without an error.
After a while it seems this problem is gone, and i was able to replicate it again if i restart mirc again.

Did any of you ever found something similar?

best regards

Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
It's normal :
Quote:
If something connects to it before i stop it and start it again
You can't re-listen on port 81 because you already have a connexion on that port

btw, $portfree doesn't take a second parameter

Last edited by Wims; 20/06/10 03:12 AM.

#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Feb 2003
Posts: 306
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 306
It does m8,on the new version

$portfree(N,[ipaddress])

Returns $true if the specified port number is not in use, where N = port number, otherwise returns $false.

When i restart the listen port i don't have the tcp active connection anymore!
I test this after some seconds

Joined: Dec 2002
Posts: 3,842
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 3,842
If a connection has been made to that port recently and you then close the listening connection, Windows places that address/port in a TIME_WAIT state, which means that it is still busy and cannot be used until Windows makes it available again. You can learn more about why Windows behaves this way by searcing for TIME_WAIT through Google.

Joined: Feb 2003
Posts: 306
T
tontito Offline OP
Fjord artisan
OP Offline
Fjord artisan
T
Joined: Feb 2003
Posts: 306
Hello Khaled, thanks for your reply

I just did a test and i am able to listen around 5 seconds after i stop the listen.
If i netstat -a i can still see the time_wait so it seems there is some other reason for this error.

In the midle i get the errors tho the portfree says it is free.

In my opinion or portfree isn't working well or the socklisten isn't doing something that does after those 5 seconds.

Best regards


p.s I did another check and it seems to give the error only while a connection that started on that port is in FIN_WAIT_1 or ESTABLISHED, after this (TIME_WAIT included) the listen works well and the sockect works correctly receiving connections.

Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
Quote:
It does m8,on the new version
$portfree(N,[ipaddress])
Sorry then, I checked but in the help file of 6.35 and the big mirc.com/versions.txt doesn't include beta changelog


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard