There are 5 max concurrent session in Cisco world. There can be a situation in life in which the max concurrent sessions reach the limits. When addressing such situations, it might help.
The following command on Unix will dump all the TCBs of the remote router:
jahil$ snmpwalk -v 2c -c your_readwrite_community router 1.3.6.1.2.1.6.13.1.1
The output will look somewhat like this:
RFC1213-MIB::tcpConnState.172.16.27.11.23.172.16.27.1.1855 = INTEGER: established(5)
RFC1213-MIB::tcpConnState.172.16.216.146.11018.172.16.216.145.179 = INTEGER: established(5)
RFC1213-MIB::tcpConnState.172.16.216.154.20081.172.16.216.153.179 = INTEGER: established(5)
RFC1213-MIB::tcpConnState.172.16.216.185.646.172.16.216.186.11028 = INTEGER: established(5)
Each line of output will have the local IP address, followed by the local TCP port, then the remote IP address and the remote TCP port. Of course, you're interested in local ports 22 (ssh) and 23 (telnet). Resetting BGP sessions will not gain you access to your router. So in this example, the first line is the interesting one. In a real case, there could be several pageful of output which you need to scan. Please note that you're only interested in the part to the left of the '='.
Once you have done the previous command and identified the interesting line(s), you have to issue the following command:
Jahil $ snmpset -v 2c -c your_readwrite_community router the_abovementioned_line i 12
So in this particular case, the command you'd have to issue would be:
Jahil $ snmpset -v 2c -c your_readwrite_community router RFC1213
MIB::tcpConnState.172.16.27.11.23.172.16.27.1.1855 i 12
The 'i 12' at the end of the line is what tells the router to clear the session. The router will reply with:
RFC1213-MIB::tcpConnState.172.16.27.11.23.172.16.27.1.1855 = INTEGER: deleteTCB(12)
You should now be able to log into the router. If not, it means you cleared the wrong session, and you need to repeat the procedure.