| View previous topic :: View next topic |
| Author |
Message |
Vic D'Elfant Past Contributor


Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Thu Oct 31, 2002 8:07 am Post subject: Auto reconnect |
|
|
Does anyone knows a script which tries reconnecting to a server(using vdsinet.dll), even when the server isn't online?
I made somethin' like this, but it don't works:
Client software
| Code: | Title Client
external vdsinet.dll
net socket,vdsevents,1
net socket,auto,1
net socket,port,888
net socket,client
:reconnect
if @not(@equal(@net(socket,status),connected))
net socket,client
wait 5
goto reconnect
end
info Connected!
exit |
But when I use this script and I try to shutdown the computer, this program doesn't close.
Of course, because there's a loop in it.
Any ideas or suggestions are welcome,
Vic _________________ phpBB Development Team |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Oct 31, 2002 9:02 am Post subject: |
|
|
| Code: | Title Client
external vdsinet.dll
net socket,vdsevents,1
net socket,auto,1
net socket,port,888
net socket,client
:reconnect
if @not(@equal(@net(socket,status),connected))
net socket,client
wait 5
%E = @event()
If @equal(%E,CLOSE)
Goto %E
End
goto reconnect
end
info Connected!
:CLOSE
exit |
Dropping an event routine in there will catch the CLOSE when either you
click the X on your window, or Windows closes it.
-Garrett |
|
| Back to top |
|
 |
Vic D'Elfant Past Contributor


Joined: 26 Jun 2002 Posts: 673 Location: The Netherlands
|
Posted: Thu Oct 31, 2002 6:39 pm Post subject: |
|
|
Thanx Garret!
Stupid I didn't thought about that
Vic _________________ phpBB Development Team |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Thu Oct 31, 2002 7:56 pm Post subject: hummm |
|
|
question
how to make it pop-up a window WHEN it don't connected:
| Code: |
:CONNECT
dialog set,STATUS1,@net(socket,status)
list clear,list1
list add,LIST1,Connected.
list seek,LIST1,@pred(@count(LIST1))
goto evloop
|
thanks |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Fri Nov 01, 2002 4:29 am Post subject: any one |
|
|
any one have any ideas?
thanks |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Nov 01, 2002 7:20 pm Post subject: |
|
|
Do you mean something like this??
| Code: | :Evloop
wait event,1
goto @event()
:Timer
if @equal(@net(socket,status),closed)
dialog set,status1,Not connected
rem You can also put an INFO in here if you like...
end
goto evloop |
|
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Fri Nov 01, 2002 8:58 pm Post subject: hummm |
|
|
yea but i'am not using a timer: varible so how would i do it then?
thanks |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Nov 01, 2002 9:08 pm Post subject: |
|
|
It's not a Timer variable, but Label...
But, you can add something like this:
| Code: | :Evloop
wait event
if @equal(@net(socket,status),closed)
dialog set,status1,Not connected
rem You can also put an INFO in here if you like...
end
goto @event() |
But, this will only check for a connection if there is an event. |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Fri Nov 01, 2002 9:10 pm Post subject: humm |
|
|
sorry for the dumb question what you mean by "if there is an event." please explain
thanks |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Fri Nov 01, 2002 9:12 pm Post subject: and my looks like this |
|
|
my code there is this:
| Code: |
:evloop
%E = @event()
if %E
goto %E
end
%E = @net(socket,event)
if %E
goto %E
end
goto evloop |
|
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Nov 01, 2002 9:20 pm Post subject: |
|
|
With 'if there is an event' I meant that there must happen something with your program, like clicking a Button or List or something like that...
| Code: | :evloop
%E = @event()
if @equal(@net(socket,status),closed)
dialog set,status1,Not connected
rem You can also put an INFO in here if you like...
end
if %E
goto %E
end
%E = @net(socket,event)
if %E
goto %E
end
goto evloop |
Btw. I've editted your code. It should work proper now... |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Fri Nov 01, 2002 9:57 pm Post subject: ok but |
|
|
that don't work that way cuase then i get a msg BEFORE i even hit the "connected" button i wanted it so that AFTER it tries to connected and if it don't then pop-up a window...but this is AFTER i hit the connected button
thanks |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Nov 01, 2002 10:05 pm Post subject: |
|
|
Not exactly sure what you're doing here, but...
You may need another loop that only runs after you
hit the "connect" button, that would check the connect
status for a few seconds (and give it time to connect)
before returning to the regular EVLOOP...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
tim6389 Professional Member


Joined: 01 Aug 2002 Posts: 790
|
Posted: Fri Nov 01, 2002 10:12 pm Post subject: hummm |
|
|
hummmm i think i follow what you mean
why can't i just add something like this :
| Code: |
if @equal(@net(socket,status),closed) |
put this under the :connect ( which i have the coded posted above)
thanks |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Nov 01, 2002 10:16 pm Post subject: |
|
|
Ya prolly can. Might give it a "WAIT x" first though...
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
|