Ping-script for maintaining Gprs connection
Quite often, operators (and providers) offer cheap Internet - or even provide an anlim.
But at us all not as at people, it is simple so can not be happiness.
Often the connection is broken or "plugged" "sticks" (when the connection does not break, but the data does not go).
Anyone who encounters this problem will be helped by a simple script-pingovalochka.
Its meaning: periodically pings the address. In the absence of ping (when the channel is "stuck" or broken), reconnection occurs.
Running this script, you can be sure in maintaining the working capacity of the connection.
Procedure
1. Create a cmd file in the notebook (for example, pinger.cmd) with the following contents:
@echo off Echo% date%% time% --- STARTED --- >> pinger.log Set Try = 1 Rem All settings are in this block Rem connection name Set DialName = Life Rem Login Set Login = Login Rem Password Set Pass = Password Rem ping timeout in ms Set TimeOut = 10000 Rem number of ping attempts Set MaxPing = 5 Rem pause in s Set Pause = 30 Rem host address for ping Set host = ya.ru Rem your phone number Set PhoneNum = 80631234567 : Start Echo. Echo start ping Ping% host% -n 1 -w% TimeOut% If errorlevel = 1 goto bad Goto ok : Ping Echo. Ping% host% -n 1 -w% TimeOut% If not errorlevel = 1 goto ok Set / a Try =% Try% + 1 If% Try% geq% MaxPing% goto bad Goto ping : Ok Echo. Echo ALL RIGHT Goto end : Bad Set / a Try = 1 Echo. Echo BAD CONNECT Echo% date%% time% -! Trouble, reconnect! - >> pinger.log Rasdial% DialName% / disconnect Rasdial% DialName% / phone:% PhoneNum% Rasdial% DialName%% Login%% Pass% If errorlevel = 1 goto bad Goto ping : End Set / a Try = 1 Echo. Choice / C: PRDE / T: P, 30 / N Pause 30 seconds. [P] ing [R] econnect [D] isconnect [E] xit? Rem echo. Rem echo. Goto% ERRORLEVEL% :1 Goto ping : 2 Goto bad : 3 Rasdial% DialName% / disconnect :4 Echo% date%% time% == Exit script == >> pinger.log
In the given file it is necessary to replace MANDATORY :
- Name of connection (set DialName = Life) [see name: Start - Settings - Network connections - name of your connection]
- Login / password (set Login = Login set Pass = Password) - if required to establish a connection
In the given file it is necessary to replace (if desired):
- The host address that pings (set host = ya.ru)
- Ping timeout (set TimeOut = 10000)
- The number of ping attempts (set MaxPing = 5) after which will reconnect
- Interval of connection check (set Pause = 30)
2. Next to pinger.cmd, put "choice.com" from the choise.rar archive.
3. Run and enjoy life - pingovalka will establish a connection and will maintain it in working order.
!!! Similar script "pinger" for Linux to maintain vydelenki pinger.zip.
Comments
When commenting on, remember that the content and tone of your message can hurt the feelings of real people, show respect and tolerance to your interlocutors even if you do not share their opinion, your behavior in the conditions of freedom of expression and anonymity provided by the Internet, changes Not only virtual, but also the real world. All comments are hidden from the index, spam is controlled.