NOTE TO MODS: I wasn't sure in which category my question would fit in so if i have posted in a wrong section plz move it in the right section.Thanks

Ok guyz here is the problem.

I have a router which is accessed from the browser. I also have to give the password before accessing the router. There is also an option for restarting the router from the browser menu.

Ok now the problem is that the speed of my dsl connection changes every time i restart the router. sometimes there is little difference between the old and new speed other times the difference is very great.

What i want is some sort of program,script,anything which automatically restarts the router and keeps doing it until i get the desired speed.

I am complete newbie in programming i know very little C++ and i haven't written more than a few very very basic console programs with no experience either in graphical programming nor in shell scripting.

What I require is general guidance on where to get started.
Books,links,tutorials,anything that would help.

PS: Plz guyz dont tell me that i have to call my ISP or that my hardware will get damaged and such stuff because i have already done everything and the only way that i can solve the problem is from my end.thanks

Dani AI

Generated

A focused, practical plan that builds on the replies from , and : turn the task into a measurement + action loop (measure current throughput or DSL sync stats, trigger a programmatic reconnect if below target, wait for resync, re-measure, stop when the threshold is met). Automation usually follows one of three routes: mimic the router web session (cookies/POSTs), script a CLI/SSH/telnet interface if the router offers it, or power-cycle the unit with a networked smart plug. Shell or Python scripting is the fastest way to prototype this; full C++ is overkill for a first proof-of-concept.

Key steps and practical notes:

  • Capture how the router UI actually logs in and invokes the reboot (Browser DevTools -> Network). Note cookies and any hidden token names; these determine the curl/request sequence.
  • Choose a measurement that reflects the desired outcome: automated speed test (speedtest-cli) or the router's DSL sync/SNR/attenuation values (status page or SNMP if supported). Use that value as the loop trigger.
  • Implement a safe loop: measure, if below threshold then trigger reboot, wait enough time for PPP/DSL negotiation, re-measure, log results, stop on success or after N attempts.
  • For JS-heavy pages, use Selenium (headless Chrome) to reproduce button clicks; for simple POST flows, curl or Python requests + session is sufficient.

Example skeleton (adapt form fields, URLs, and waits to the actual device):

#!/bin/sh
TARGET=50    # target download Mbps
LOGIN_URL="http://192.168.1.1/login.cgi"
REBOOT_URL="http://192.168.1.1/reboot.cgi"
USER=admin; PASS='changeme'

while true; do
  DL=$(speedtest-cli --simple 2>/dev/null | awk '/Download/ {print int($2)}')
  [ -n "$DL" ] && [ "$DL" -ge "$TARGET" ] && break

  curl -s -c /tmp/cookies.txt -d "username=$USER&password=$PASS" "$LOGIN_URL"
  curl -s -b /tmp/cookies.txt -X POST "$REBOOT_URL"
  sleep 120   # allow time to resync; increase if needed
done

Operational tips and cautions: log timestamps, attempt counts and the measured values to a CSV for analysis; set a maximum retry limit to avoid endless loops; increase the post-reboot wait until PPP/DSL has fully reconnected before measuring; prefer SNMP or router status values for link-quality signals (SNR, attenuation) if available rather than raw throughput alone. If the router UI is unclear, capture the exact network requests and POST fields first — that is the single most important diagnostic step suggested earlier by .

Recommended Answers

All 4 Replies

Hi and welcome to DaniWeb

It looks like you have trouble with internet connection which sometimes you get low and high speed altogether...

If you can get high-speed connection, then there's no problem with your router, it was probably your ISP giving random connection to your router.

When your router are in high-speed internet connection, how long does it last? If it's high in the beginning and started to slow later, it's normal (for me at least)

Welcome to daniweb. I need to know some information

1) When does your internet connection starts to get slow and when does your internet connection get fast?

2) DO a Ping Test and report back. Copy and Paste the Ping Test results here

3) Tell me how many packets are seent and receive.
Example : Packets in: 784490
Packets out: 34661

4) Tell me what is your Internet Speed

Example 100Mb/s

5) Tell me what router are you using?

6) Is any security software hindering the problem

Good luck and hope to hear a reply soon

HI
you can read "introductioc to C++ by yashvant kanetkar and programming in C++ by robert laford. practice will improve your programming.
good luck

Have you change any settings in your router control panel?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.