Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.016 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'escape': 0.07; 'pressing': 0.09; 'subject:characters': 0.09; 'teh': 0.09; 'dec': 0.15; 'close()': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'keycode': 0.16; 'quit.': 0.16; 'telnetlib': 0.16; 'wrote:': 0.17; 'instance,': 0.17; 'thu,': 0.17; '(in': 0.18; 'this:': 0.23; 'command': 0.24; 'header:In-Reply-To:1': 0.25; 'leave': 0.26; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'regular': 0.27; "doesn't": 0.28; "i'm": 0.29; 'connection': 0.30; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'similar': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'actions': 0.36; 'subject:with': 0.36; 'drop': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'subject:, ': 0.61; 'back': 0.62; '20,': 0.65; 'stuck': 0.65; 'direct': 0.69; 'special': 0.73; 'prompt': 0.78 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=k5XuwnqgA3QDXACj/bvdDwAUopZscoOb9d+NzX5nuzc=; b=lrUjl36iOEOVjYPPjIZW3MnV/kn0LPj8zVG0dA7VEc0tzNV+wJAHy/zSA8dMzpBGq3 OLV3yjtERXFdaCBgissF6uXLOtA/iqU8i8WmugNzg/H++oDC1yEQ00bxsGZoISsvfnzV QjMTmseW7sagIVJ0bFtMNO9QHyALBHN7M9DOnBGWlLFjmIOItsV4+AJj5UuEafE0tPCd CzzNCIHC13RW7inFA2yAQhRcnMTEIaTn9Pl5GsUuKg1pF5n0hvrrWq1yFoSx0lSWPvLn GyWex8v10ujych6Wnhn9WoA2KcYGrraAAmtipQXb7o5dLW61s2nMt6yZ5+VDXhuiGtHP K/Jg== MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 20 Dec 2012 01:57:18 +1100 Subject: Re: Telnetlib and special quit characters with Ctrl, oh my! From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355929054 news.xs4all.nl 6874 [2001:888:2000:d::a6]:54627 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:35126 On Thu, Dec 20, 2012 at 1:28 AM, wrote: > I am using telnetlib and the box that I'm connecting to has a special escape sequence--^]--to leave the prompt and go back to the regular telnet prompt. For example, from teh command line I do this: > ... > When I pressing and hold Ctrl and then ], I go back to my normal telnet prompt and can quit. > > Using telnetlib, I can send commands and get responses. But I'm stuck on sending the ctrl+]! Is there some escape character--\c?--or a keycode like \^ to send through telnetlib? The ctrl-] keystroke doesn't get sent down the wire, it's commands to the _local_ telnet. For instance, if your session has stalled, you can enter "^]close" to immediately disconnect. There won't be a direct way to drop to "command mode" inside telnetlib, but you can do similar actions with methods on the connection object (in that instance, close() will do the job). ChrisA