My problem is my For Loop is not working in the way it should please help...
Why my script do is create an incoming connection(Dial-In) wait arround 30s to modem connection complete, then search on Systray tooltips to find if the connection is established and then run netstat to check if the incoming user have an established connection with my mail server, POP3 or SMTP, if not then delete connection in 2 minutes or so.
But if the user have an established connection with my mail then wait until a maximun of 16Min so so...
The problem is sometimes the user is downloading mails and the script go and delete the connection so for some reason my netstat loop is not working very well i will put here the functions involved but if someone need the entire code letme know...
Thanks in advance... Kind Regards Alien.
Func Conected() If FileExists(@ScriptDir&"-Status.txt") Then FileDelete(@ScriptDir&"-Status.txt") EndIf _RunDOS('netstat -anop TCP > ' & @ScriptDir&"-Status.txt") Local $aRecords _FileReadToArray(@ScriptDir&"-Status.txt",$aRecords) $pcname = @ComputerName For $x = 1 to $aRecords[0] If StringInStr($aRecords[$x], "192.168.0.1"&":25") AND _ StringInStr($aRecords[$x], "ESTABLISHED") OR _ StringInStr($aRecords[$x], "192.168.0.1"&":110") AND _ StringInStr($aRecords[$x], "ESTABLISHED") _ Then $conexyes = 1 Else $conexyes = 0 EndIf Sleep(50) Next EndFunc Func CheckConexMail() If Get_ConexExist($conexname) = 0 AND $delcon = 0 Then DelConex() EndIf While Get_ConexExist($conexname) <> 0 Conected() If $conexyes <> 0 Then Sleep(500) $conbreak = $conbreak + 1 If $conbreak >= 1800 AND $delcon = 0 Then DelConex() ExitLoop Else If Get_ConexExist($conexname) <> 0 Then CheckConexMail() ElseIf $delcon = 0 Then DelConex() ExitLoop EndIf EndIf Else Sleep(500) $conectime = $conectime + 1 If $conectime >= 60 AND $delcon = 0 Then DelConex() ExitLoop Else CheckConexMail() EndIf EndIf WEnd EndFunc







