TCL Socket Help

I've been trying to write a script that would telnet to another device to run some commands. Unfortunately, whatever I do, it seems I'm never getting past the motd banner. When executed, the script does open the session, and I get the full banner, but then it stops until the other device times out. I never the "Username:" prompt. Wireshark tells me the prompt is delivered, so I don't know what I'm doing wrong.
Help!
proc waitfor {sock pattern {delay 500}} {
  while { 1 } {
    after $delay { return -code error "delay expired" }
    gets $sock line
    puts $line
    if { [string match [string tolower $pattern] [string tolower $line]] } {
      puts "match"
      return -code ok
set host "yoink!"
set username "yoink!"
set password "yoink!"
set hostname "yoink!"
puts "Trying to connect to $host\n\n"
set sock [socket $host 23]
waitfor $sock "username:"
puts $sock $username
waitfor $sock "password:"
puts $sock $password
waitfor $sock "$hostname#"
puts $sock "show clock"
waitfor $sock "$hostname#"
close $sock

After some more tests, I found something odd.
Here's an output while running the script.
router#tclsh tftp://10.120.1.2/telnet3.tcl
Loading telnet3.tcl from 10.120.1.2 (via GigabitEthernet0/0): !
[OK - 811 bytes]
Trying to connect to 10.180.39.1
{^A{^C}^X}^_    <- Telnet negociation garbage
MOTD Banner Here!
Username:       <- There's a long delay (auth timeout) before this appears
                   And all following lines appear at once.  
step 2          <- Some debug
% Username:  timeout expired!
error reading "sock0": broken pipe
    while executing
"gets $sock line"
    (procedure "waitfor" line 4)
    invoked from within
"waitfor $sock "password:""
    (file "tftp://10.120.1.2/telnet3.tcl" line 28)
router#
So I did a manual telnet, and it looks like this.
router#telnet 10.180.39.1
Trying 10.180.39.1 ... Open
MOTD Banner Here!
User Access Verification  <- This line doesn't appear in the script
Username:
So it seems this line is causing the script to bog down somehow.

Similar Messages

  • TCL sockets broken in 12.2(58)SE ?

    Hi,
    I have been working on a tcl script that performs autoprovisioning of catalyst 2960 switches. The scripts sends an email report using TCL TCP sockets on port 25.
    The problem I'm facing now is that I did a cross-check on the newest-released IOS 12.2(58)SE, and it appears that the TCL socket functionality is not working anymore on Catalyst 2960 *AND* 3560 switches :
    Switch#tclsh
    Switch(tcl)#socket 10.190.2.8 25
    couldn't open socket: invalid argument
    Switch(tcl)#
    whereas with previous versions it would work correctly :
    Switch#tclsh
    Switch#socket 10.190.2.8 25
    sock0
    Switch#
    -server sockets still seem to work but that's not what I need.
    Using EEM SMTP applets is not an option as well since that's not supported on a Catalyst 2960....
    Thanks,
    Koen.

    OK, thanks for the help.
    FWIW, on a cat 3560 it is possible to send an email using an EEM applet (Action x.x mail server "etc"), which -I think- also uses TCL.
    I guess the difference is that EEM applets are not restricted as much as user-issued tcl scripts (Safe-tcl).
    Best regards.

  • TCL socket

    Hello friends,
    not so long time ago i found out about tcl scripts that can be executed on cisco devices and found this very exciting. So i got me some books with tcl basics and had some good time studying it, now i want to explore some more advanced topics, such as let's say client-server communication. I found examples and even some explanations, but i am just not getting it. Is there a nice fella here on this forum who could chew it over for me? Let's say for example i want to create a socket between server on one router and client on another and i want server and client to communicate via messages bidirectionaly (client sends a string then server receives it and prints out to stdout and vise versa).
    So server side is something like:
    proc OnConnectProcedure {channel clientaddr clientport} {
        puts "$clientaddr connected"
        puts $channel "Hello, Client"
        close $channel
    socket -server OnConnectProcedure 9990
    vwait forever
    and this server will wait for connection on port 9990, print out "x.x.x.x connected" and send hello client message to the client. Right?
    What is on the other side?
    set server x.x.x.x
    set sckt [socket $server 9990]
    gets $sock str
    puts "Server said: $str"
    close $sockChan
    But that about when a lot of questions come to my mind... How should messages go the other way - from client to server, how and when do i use fileevent (readable, writable), fconfigure, sync option, when do i need to flush the channel? How and when should i wait for the EOF in channel?
    I greatly appreciate any help and thank you in advance. 

    You can actually use straight examples of Tcl client/server communication on IOS with a few minor mods.  Take a look at
    http://www.tcl.tk/about/netserver.html .  What you would need to do is wrap these scripts in EEM syntax.  For example, on the server side:
    ::cisco::eem::event_register_none
    namespace import ::cisco::eem::*
    namespace import ::cisco::lib::*
    array set arr_einfo [event_reqinfo]
    # Echo_Server --
    #     Open the server listening socket
    #     and enter the Tcl event loop
    # Arguments:
    #     port     The server's port number
    proc Echo_Server {port} {
        set s [socket -server EchoAccept $port]
        vwait forever
    # Echo_Accept --
    #     Accept a connection from a new client.
    #     This is called after a new socket connection
    #     has been created by Tcl.
    # Arguments:
    #     sock     The new socket connection to the client
    #     addr     The client's IP address
    #     port     The client's port number
    proc EchoAccept {sock addr port} {
        global echo
        # Record the client's information
        puts "Accept $sock from $addr port $port"
        set echo(addr,$sock) [list $addr $port]
        # Ensure that each "puts" by the server
        # results in a network transmission
        fconfigure $sock -buffering line
        # Set up a callback for when the client sends data
        fileevent $sock readable [list Echo $sock]
    # Echo --
    #     This procedure is called when the server
    #     can read data from the client
    # Arguments:
    #     sock     The socket connection to the client
    proc Echo {sock} {
        global echo
        # Check end of file or abnormal connection drop,
        # then echo data back to the client.
        if {[eof $sock] || [catch {gets $sock line}]} {
         close $sock
         puts "Close $echo(addr,$sock)"
         unset echo(addr,$sock)
        } else {
         puts $sock $line
    Echo_Server $arr_einfo(arg1)
    Register this as an EEM Tcl policy (assuming this script lives in flash:/policies as no_echo_server.tcl on the device):
    event manager directory user policy flash:/policies
    event manager policy no_echo_server.tcl
    Then run it from EXEC mode:
    event manager run no_echo_server.tcl 3333
    That will start a listening socket on tcp/3333 on this device.
    On the client device, create a script called no_echo_client.tcl with:
    ::cisco::eem::event_register_none
    namespace import ::cisco::eem::*
    namespace import ::cisco::lib::*
    array set arr_einfo [event_reqinfo]
    # A client of the echo service.
    proc Echo_Client {host port} {
        set s [socket $host $port]
        fconfigure $s -buffering line
        return $s
    set sock [Echo_Client $arr_einfo(arg1) $arr_einfo(arg2)]
    puts $sock "Hello!"
    gets $sock response
    puts "Response is $response"
    Again, register this policy, then run it from EXEC mode with:
    event manager run no_echo_client.tcl 10.1.1.1 3333
    Where 10.1.1.1 is the IP address of the first (i.e., server) device.
    That's it.  That's a simple client/server example on IOS with EEM.

  • TCL script help needed on Nexus7000 !

    Does anyone know how to create a TCL script on Nexus7000 switch for following scenario ? Need urgent help here.. :-
    Here is what I am trying to do :-
    1. Whenever following log on "show log log" prints out :-
    testnexus7000 %PIXM-2-PIXM_SYSLOG_MESSAGE_TYPE_CRIT:
    2. Print out the output of show system internal pixm errors
    And look for following line :-
    [102] pixm_send_msg_mcast(1208): MTS Send to LC X failed >> where X is 0 based
    and this error can occur multiple times for different LCs too.
    4. Reload line card (s) X and syslog " task done"
    Regards
    Vijaya

    Hi,
    Vijaya I found same post on support cisco forums So people helped someone in same question !!!!!!
    Please read it ....
    https://supportforums.cisco.com/thread/2128886
    Yes plus if u can help me in ......Cisco ASA same security problem than that will be good for me .....I will contact u and will be great help for me if u help
    Hope that link help u .....
    Bye,

  • Socket help?

    Alright I have to modify these two programs for a school project. However I can't even get the ones she gave us up and running. So it's obvious that I can't modify them until I get the ones she gave us up and running. Any help that you could give me would be awesome.
    The error I get is java.net.ConnectException: Connection refused: connect
    Exception in thread "main" java.lang.NullPointerException
         at DateClient.main(DateClient.java:29)
    The programs are, please don't ask me what they do that's why I need the first one up and running. All I know is that we are supposed to send information through a socket. Thanks for the help.
      import java.net.*;
       import java.io.*;
        public class DateClient
           public static void main(String[] args) throws IOException {
             InputStream in = null;
             BufferedReader bin = null;
             Socket sock = null;
             try {
                sock = new Socket("127.0.0.1",6013);
                in = sock.getInputStream();
                bin = new BufferedReader(new InputStreamReader(in));
                String line;
                while( (line = bin.readLine()) != null)
                   System.out.println(line);
                 catch (IOException ioe) {
                   System.err.println(ioe);
             finally {
                sock.close();
       }This is the second one:
    import java.net.*;
    import java.io.*;
    public class DateServer
         public static void main(String[] args) throws IOException {
              Socket client = null;
              ServerSocket sock = null;
              try {
                   sock = new ServerSocket(6013);
                   // now listen for connections
                   while (true) {
                        client = sock.accept();
                        System.out.println("server = " + sock);
                        System.out.println("client = " + client);
                        // we have a connection
                        PrintWriter pout = new PrintWriter(client.getOutputStream(), true);
                        // write the Date to the socket
                        pout.println(new java.util.Date().toString());
                        pout.close();
                        client.close();
              catch (IOException ioe) {
                        System.err.println(ioe);
              finally {
                   if (sock != null)
                        sock.close();
                   if (client != null)
                        client.close();
         }

    'javac' is not recognized as an internal or external command,
    operable program or batch file.
    This is what I get when I attempt to compile it in the command prompt.
    hi :-)
    kidz now are having problems with DOS. they dont even know what DOS means. same problem was asked. i think it was yesterday :-( huhu :-(
    by the way try this solutions
    1. add your java folder to your Environment File PATH
    or
    2. directly access the javac from its folder
    ex. C:\Program Files\Java\jdk1.5.0_08\bin\javac filename.javaalternatively you can put that line of code on a batch file,
    so you will no longger type that long directory structure.
    regards,

  • Server Socket Help!

    Hello!
    I have a problem regarding server socket, i wrote a simple server socket program which would accept a socket then write through the DataOutputStream, using writeByte and read through the DataInputStream using readUnsignedByte.
    My server socket is a java program, and the client was created using other language (which i do not know what language but it is already existing..).
    My concern is that when I try to listen (in the server side), i would accept the socket, and the connection would now be established. BUT, whenever i would close my streams (input and output stream), the client socket I accepted and the ACTUAL server socket, the client is still connected. That's why whenever i would open my Server Socket, i would no longer receive any socket.. why is it like that..?
    Can anyone help me..? Please do so.. I would appreciate your immediate reply..
    Thanks a lot!
    Ron

    HI,
    What you need in the client app is for it to listen for a CLOSE message like this (java code but the logic is there)
    String fromServer ;
    while(( fromServer = in.readLine()) != null )
    System.out.println( "Server: " + fromServer ) ;
    if( fromServer.equals("Closing down")) //checks all the time for the CLOSE signal !
    break ;
    // other stuff
    out.close() ; // close the client end of the socket on the signal !
    in.close() ;
    You say the client app is already written. Well look in the specs and see what the CLOSE signal is.
    There MUST be one or the client app doesn't work.
    Hope that helps,

  • Multithread program with socket, help me

    Hi all, I have had some troubles with my multithread program, that is when I make 4 threads to send messages to 4 accepted ports: 2001, 2002, 2003 and 2004, it leads to the error:
    "Java.net.SocketException: Software caused connection abort: recv fail"
    I cannot understand why this exception is inconsistent. Please help me figure out
    solution for this problem. Thank you.
    Here is my code
    public synchronized void sendREQMessage(Message obj)
         for(int i=2001;i<=2004;i++)
              try
                             obj.setPortDest(i);
                             myThread thread=new myThread(obj,i);
                   catch (Exception e)
                        System.out.println(e);
    public myThread(Message obj,int i)
              message=obj;
              port=i;
              start();
         public void run()
              try
                   message.setPortDest(port);
                   connection = new Socket("127.0.0.1",port);
                   out = new ObjectOutputStream(
         connection.getOutputStream());               
                   out.writeObject(message);
                   out.flush();
                   //connection.close();
              catch(Exception e)
                   System.out.println(e);
         }

    I'm sorry, I cannot understand what you mean.
    Sometimes, the message can be sent well among 4 ports. Sometimes, it leads to the error:
    "Java.net.SocketException: Software caused connection abort: recv fail"
    And I don't know why.
    Thank for your help

  • EEM / Tcl Script Help Please

    Hello Community,
    I have been evaluating a Tcl Script posted here sometime ago, designed to help monitor track interfaces and routes, see attached.
    I believe I have applied the configurations correctly, however when I test the script by shutting down interfaces nothing happens.
    I'm sure its something very simple that I'm missing.
    I wonder if someone could take a look at the configs and let me know what I'm doing wrong. I have also attached a diagram.
    Cheers
    Carlton

    Joseph,
    I did read again and I got it to work :-)
    Cheers
    On a slightly different topic, is it possible to 'track' a static ip address?
    For example, I have the following tracking configured:
    track 1 ip route 0.0.0.0 0.0.0.0 reachability
    track 2 interface FastEthernet0/0 ip routing
    track 3 interface FastEthernet0/1 ip routing
    track 4 ip route 180.80.8.4 255.255.255.255 reachability
    track 5 ip route 170.70.7.4 255.255.255.255 reachability
    R3#show track brie
    Track   Object                         Parameter        Value
    1       ip route  0.0.0.0/0            reachability     Up (static)
    2       interface FastEthernet0/0      ip routing       Up
    3       interface FastEthernet0/1      ip routing       Up
    4       ip route  180.80.8.4/32        reachability     Down (no route)
    5       ip route  170.70.7.4/32        reachability     Down (no route)
    However, you will see that track 4 and 5 are down. This is because, although I can ping 180.80.8.4 and 170.70.7.4 the actual ip addresses don't appear in the routing table:
    Gateway of last resort is 0.0.0.0 to network 0.0.0.0
         170.70.0.0/24 is subnetted, 1 subnets
    C       170.70.7.0 is directly connected, FastEthernet0/0
         10.0.0.0/24 is subnetted, 1 subnets
    C       10.1.1.0 is directly connected, FastEthernet1/0
         180.80.0.0/24 is subnetted, 1 subnets
    C       180.80.8.0 is directly connected, FastEthernet0/1
         150.50.0.0/24 is subnetted, 1 subnets
    C       150.50.5.0 is directly connected, Ethernet2/0
    S*   0.0.0.0/0 is directly connected, FastEthernet1/0
    R3#
    Therefore, is there way of creating a track for /32 ip addresses?
    I hope that makes sense.
    Cheers

  • IPlate/Master Socket, Help Needed!

    (Before i start this is my first post so  sorry if i mess something up )
    Hi,   
    I want to install a BT Iplate but i have a Master socket that is not supported. (Pic below)
    Is there any chance i can change my master socket to the one below so i can install an iplate?

    Hi Eaglealex7,
    The newer Openreach BTNTE5 master socket already filters interference from extension sockets. Pre-filtered ADSL/VDSL master sockets also already filters interference from extension sockets.
    if you have a look at this link here it will tell you what Master sockets work with the iplate / Accelerator : http://www.productsandservices.bt.com/consumerProd​ucts/displayTopic.do?topicId=25075
    The accelerator/iplate can sometimes cause more issues in some cases. Have a look at removing the BellWire/Ring wire from terminal 3 of your master socket and extension sockets which does the same thing as the accelerator/iplate but sometimes more effective. Link : bellwire removal
    Cheers
    jac_95 | BT.com Help Site | BT Service Status
    Someone Solved Your Question?
    Please let other members know by clicking on ’Mark as Accepted Solution’
    Try a Search
    See if someone in the community had the same problem and how they got it resolved.

  • Tcl script help -- include interface description in status message

    Hi there,
    I'm trying to create a script that will email me when an interface goes down, and include the interface description in the email.  I've found a script that successfully emails me when the status changes, and I found another script that will parse for the interface description, but I can't seem to get them to work together.  I've mashed them up together into the below script:
    # EEM policy that will monitor SYSLOG for Interface status changes.
    # If UPDOWN message is detected, send an email with interface information.
    ### The following EEM environment variables are used:
    ### _email_server
    ### - A Simple Mail Transfer Protocol (SMTP)
    ### mail server used to send e-mail.
    ### Example: _email_server mailserver.example.com
    # Register for a Syslog event. Event Detector: Syslog
    # Match pattern for Interface Status change
    ::cisco::eem::event_register_syslog pattern "%LINK-3-UPDOWN"
    # NAMESPACE IMPORT
    namespace import ::cisco::eem::*
    namespace import ::cisco::lib::*
    # Set array for event_reqinfo
    # Array is populated with additional event information
    array set Syslog_info [event_reqinfo]
    set msg $Syslog_info(msg)
    # Set routername variable for use later
    set routername [info hostname]
    # Parse output for interface name
    if { ! [regexp {: ([^:]+)$} $msg -> info] } {
        action_syslog msg "Failed to parse syslog message"
    regexp {Line protocol on Interface ([a-zA-Z0-9]+)} $info -> interface 
    # ------------------- cli open -------------------
    if [catch {cli_open} result] {
    error $result $errorInfo
    } else {
    array set cli $result
    # Go into Enable mode
    if [catch {cli_exec $cli(fd) "enable"} result] {
    error $result $errorInfo
    #Find interface description
    if [catch {cli_exec $cli(fd) "show interface $interface | inc Description" } description] {
            error $description $errorInfo
    #--------------------- cli close ------------------------
    cli_close $cli(fd) $cli(tty_id)
    set time_now [clock seconds]
    set time_now [clock format $time_now -format "%T %Z %a %b %d %Y"]
    # EMAIL MESSAGE
    # This manually creates a text message with specific format to be used by the
    # smtp_send_email command later to send an email alert.
    # Ensure the following are configured:
    # ip domain-name <domain.com>
    # If a hostname is used for mailservername, ensure the following are configured:
    # ip name-server <dns-server>
    # ip domain-lookup
    # NOTE: Change environment variable _email_server to your SMTP server
    # The email below references the following variables:
    # $routername: hostname of device
    # $time_now: time when specific Syslog message was detected
    # $msg: Syslog message received
    set email_message "Mailservername: $_email_server
    From: [email protected]
    To: $_email_to
    Cc:
    Subject: EEM: Critical interface status change on $routername
    This email is generated by EEM.
    $time_now
    $msg
    $description
    # Send email message
    if {[catch {smtp_send_email $email_message} result]} {
    set result "Email send failed"
    } else {
    set result "Email Sent"
    # Debug message to check email transmission status
    action_syslog msg "$result"
    When I trigger an interface UPDOWN message, I'm getting the following error on the command line:
    Oct 17 23:56:19.355 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl: can't read "interface": no such variable
    Oct 17 23:56:19.355 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl:     while executing
    Oct 17 23:56:19.355 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl: "cli_exec $cli(fd) "show interface $interface | inc Description" "
    Oct 17 23:56:19.355 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl:     invoked from within
    Oct 17 23:56:19.355 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl: "$slave eval $Contents"
    Oct 17 23:56:19.355 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl:     (procedure "eval_script" line 7)
    Oct 17 23:56:19.355 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl:     invoked from within
    Oct 17 23:56:19.355 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl: "eval_script slave $scriptname"
    Oct 17 23:56:19.359 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl:     invoked from within
    Oct 17 23:56:19.359 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl: "if {$security_level == 1} {       #untrusted script
    Oct 17 23:56:19.359 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl:      interp create -safe slave
    Oct 17 23:56:19.359 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl:      interp share {} stdin slave
    Oct 17 23:56:19.359 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl:      interp share {} stdout slave
    Oct 17 23:56:19.359 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl: ..."
    Oct 17 23:56:19.359 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl:     (file "tmpsys:/lib/tcl/base.tcl" line 50)
    Oct 17 23:56:19.359 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl: Tcl policy execute failed: can't read "interface": no such variable
    Can anyone help me figure out where I'm going wrong? 
    Thanks in advance,
    Brandon

    Hi Dan,
    Thanks for the reply.   I've made the changes you suggested but I'm still getting the error:
    Oct 18 21:41:50.446 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl: can't read "interface": no such variable
    Oct 18 21:41:50.446 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl:     while executing
    Oct 18 21:41:50.446 HKT: %HA_EM-6-LOG: CriticalLinkStatus.tcl: "cli_exec $cli(fd) "show int $interface | inc Description""
    Is there any additional debugging I could place in my script?  Normally I would try and print the variables after each line to see what's being populated, but I'm not sure how I can test that from within EEM.
    --Brandon

  • I pad1 will only charge up via computer port.suddenly not from a wall socket. help .thanks

    my i pad1, suddenly not charge up from wall socket , just from my pc .any suggestions . thanks

    Sounds like the charging cable is OK but the charger itself may have failed. Do you have another you can try - or perhaps borrow one for testing purposes?

  • Java Sockets - help with using objects

    I am new to java sockets, and need to come up with a way to send a user defined instance of a class across a basic client/server application.
    I can not find out how to do this. I read the tutorials, but my class can not be serialized. How can I send/recieve this instance of a user defined class?

    right off the top of my head, doesn't serialver just spit out a UID for a given set of classes?
    To mark a class as Serializable, just implement the java.io.Serializable class - then you could use the readObject/writeObject methods of the ObjectInputStream/ObjectOutputStream classes.
    Good luck
    Lee

  • Unable to send .mp3 with sockets, help!

    I need to send my .mp3 files throw a server but it stays in stuck in out.write(lenght), any suggestions for another type of way to do this...
    Other files are sent fine, .pdf, .txt, .doc... i might be the size but how to solve it...
    try {
                Socket socket=null;                 
                socket = new Socket(GlobalValues.ipOut, GlobalValues.portOut);
                OutputStream out = socket.getOutputStream();     
                InputStream fis = new FileInputStream(f);
                int length=0;
                BufferedInputStream buf = new BufferedInputStream(fis);
                //byte[] buffer = new byte[9*9*1024];
                GlobalValues.creatTextArea("                 Uploading PLEASE WAIT...", 1, Color.red, 0); 
                while((length = buf.read()) != -1){
                    out.write(length);
                    out.flush();
                GlobalValues.creatTextArea("                  FINISHED upload", 1, Color.green, 0);             
                fis.close();
                out.close();
            catch(Exception e){
                e.printStackTrace();
            }

    OutputStream out = socket.getOutputStream();     OutputStream out = new BufferedOutputStream(socket.getOutputStream());
    int length=0;This is not a correct name for this variable. You are reading bytes from the input stream, not lengths. A better name would be 'data'.
    while((length = buf.read()) != -1){
    out.write(length);
    out.flush();Move this flush to after the loop.
    If you're blocking in the write() it means the reader is slow reading. Using the BufferedOutputStream may fix this.

  • Iphone 4 just turned itself off, won't turn on again - sleep/wake button hasn't worked for a while - tried charging (even though it was 50% charged when it shut down) and that makes no difference....tried usb to computer and directo to wall socket. help?

    phone 4 just turned itself off, won't turn on again - sleep/wake button hasn't worked for a while - tried charging (even though it was 50% charged when it shut down) and that makes no difference....either via usb to computer and direct to wall socket. Any suggestions...other than heading off to the genius bar tomorrow?

    Well, the sleep/wake button is also the power button. If you cannot use it to turn on, then you cannot use it to perform a reset by holding it and the home button together until you see the Apple logo.Those are the only two ways to turn the device on. You can try letting the battery go completely dead and then trying to plug it in. After it has charged for 20-30 minutes, the device may come back on. But, without the sleep/wake button, there is no other way to turn the device on or off.

  • Need socket help

    Hello I am trying to send a byte array to an other computer but
    I get this message
    java.netConnectException: Connection refused:
    I read this about the error
    If the server is not responding on the port we?re looking for, we?ll get a ?java.netConnectException: Connection refused:..? message.
    but with a c program that works I receive data.
    This is my code
    msg1 is a byte array I want to send
    String server = "10.20.40.74";
    int port = 11220; //echo port
    //First conduct a TCP echo test
    try{
    //Get a socket, connected to the specified server
    // on the specified port.
    Socket socket = new Socket(server,port);
    //Get an input stream from the socket
    BufferedReader inputStream =
    new BufferedReader(new InputStreamReader(
    socket.getInputStream()));
    //Get an output stream to the socket. Note
    // that this stream will autoflush.
    PrintWriter outputStream =
    new PrintWriter(new OutputStreamWriter(
    socket.getOutputStream()),true);
    //Send line of text to the server
    outputStream.println(msg1);
    //Get echoed line back from server and display it
    System.out.println(inputStream.readLine());
    //Close the TCP socket
    socket.close();
    }//end try
    catch(UnknownHostException e){
    System.out.println(e);
    System.out.println(
    "Must be online to run properly.");
    }//end catch UnknownHostException
    catch(SocketException e){System.out.println(e);}
    catch(IOException e){System.out.println(e);                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    If I do this (telnet) I get connection refused.
    But when I use the same address and portnumber with my c program I get an answer.
    The computer where I send the array to is listening at address 10.20.40.74 at port 11220, but wants an encrypted byte array, is it possible that the array isn't encrypted on the right way so it doesn't understand what it has to do with it and that's why the connection is refused??

Maybe you are looking for

  • Scanning cuts off bottom 1/2"

    I have an HP OfficeJet 7410 All-in-One. When I scan an 8.5' x 11" page, using the Automatic Document Feeder, it cuts off the bottom 1/2", no matter what program I use to control the scan (the latest versions of HP ScanPro and Adobe Acrobat). If I don

  • Bank statement: problem to load variable length field

    we have many bank accounts with different banks, and we would like to use the bank reconciliation module to do bank reconciliation. we have problem in load the MT940 bank statement. All these banks are providing so called standard SWIFT940 format, wh

  • How do I make multiple screens transition?

    I have figured out how to make multiple camera angles play onscreen at one time, but I would like the layout to change while the video plays, how do I do this (or at least get started)?  I realize that this is probably basic, but I am making the move

  • Cannot Burn to CD

    Hello all. I was trying to burn an album of less than 100Mb to a CD, all I get was this error message: Burn Failed The burn to the MATSHITA DVD-R UJ-845 drive failed. The device failed to calibrate the laser power for this media How? How can I solve

  • Sharing permission issues

    i'm a mac newbie. I have external hardisks that I partitioned into different volumes to act as my backup for different media. For example, there's a volume for music, pictures, etc. Because these are backups, I don't want any user beside me to access