Telneting and J Text Area

(I have the same Issue!! Please Help!)
Hello,
My program is able to telnet into a remote machine and the text is displayed using JTextArea. However whin I do a 'dir' on the host
my JtextArea (Using setText(String)) appears to be getting the data yet no other data is displayed.
Any sugesstions? (Please see the 'tagged' code below)
Thanks
public class RemoteConnection
/* Constructor */
public RemoteConnection(String Host, int TelnetPort)
try
{ /* Create a new Socket and call the pipe streams */
/* This does not output data to the window */
socket = new Socket(Host, TelnetPort);
/* This works...I can create a terminal emulator*/
//socket = new Socket("time.gov", 13);
new InputPipe(socket.getOutputStream()).start();
new OutputPipe(socket).start();
catch(IOException e)
txtTelnetWindow.setText("");
txtTelnetWindow.setText("Error Could not connect to host: "+Host);
return;
}/* end Constructor */
* Inner class (to Remote Connection ) which
* handles the input stream pipe
public class InputPipe extends Thread
/* Create objects of type DataInputStream and PrintStream */
//DataInputStream is;
PrintStream os;
BufferedReader BR_is;
String TheTxt;
public InputPipe(OutputStream os)
/* Creates a Input Stream Reader that uses an underlying buffered reader */
this.BR_is = new BufferedReader(new InputStreamReader(System.in));
this.os = new PrintStream(os);
public void run()
String line;
try
while(true)
line = BR_is.readLine();
// TheTxt = txtTelnetWindow.getText();
//txtTelnetWindow.setText(line);
/* Print one character at a time */
os.println(line);
/* Note: DOS only knows "\n", "\r" is Unix */
//Used "line seperator" instaed
//os.print("\r\n");
//os.print("\n");
os.flush();
catch(IOException e)
throw new RuntimeException("Failed to read or print the line");
}/* end class input pipe */
* Inner class (to Remote Connection ) which
* handles the output stream pipe
public class OutputPipe extends Thread
/* Create Stream Objects */
InputStream in;
OutputStream ot;
PrintStream os;
public OutputPipe(Socket socket)
try
this.ot = socket.getOutputStream();
this.in = socket.getInputStream();
this.os = new PrintStream(System.out);
catch(Exception e)
System.out.println("Oops3");
public void run()
/* Create a new String Buffer
*This was the whole formating issue */
StringBuffer sb = new StringBuffer();
/* Work on reading text from the counsol */
int i;
try
while(true)
/* Reads the next byte of data from the input stream */
i = in.read();
if (i == 255) /* Read in the IAC bytes. Start over after 255th byte*/
int i1 = in.read();
int i2 = in.read();
Connect(i1,i2);
else
/* Prints out sun OS, username and login */
sb.append(""+(char)i);
//sb.append("\n");
System.out.print((char)i);
os.flush();
txtTelnetWindow.setText(sb.toString());
catch(Exception e)
txtTelnetWindow.setText("");
txtTelnetWindow.setText("You are no longer connected to the host");
private void Connect(int i1, int i2)
int i = i1;
if (i == 253)/* 253 = "DO"*/
{ /* Write characters to the print Stream */
i = i2;
if (i == 1) WriteBytes(i);/* Echo */
else if (i == 24) WriteBytes(i);/*TTYPE */
else if (i == 31) WriteBytes(i);/* NAWS */
else if (i == 35) WriteBytes(i);
else if (i == 36) WriteBytes(i);
else if (i == 39) WriteBytes(i);
private void WriteBytes(int i)
{ String ReadTxt;
try
/* Write the bytes to the output stream from the host machine*/
ot.write(255); /* IAC*/
ot.write(252); /* WONT*/
ot.write(i); /* DO */
catch (Exception e)
System.out.println("oops5");
} /* End output Stream class */
}/*End Class Remote Connection*/

Reshy,
You shouldn't post the same question on 3 different forums. Please refer to my answer on 'Advanced Language Topics' and if that works I want these Dukes as well ;).
Dom.

Similar Messages

  • I just downloaded OS X Mavericks and my texts are not coming through to my Mac at all. How do i change that??

    I just downloaded OS X Mavericks and my texts are not coming through to my Mac at all. How do i change that??

    Open Messages. Then go to the Menu and click on Messages. In the drop down select Preferences. Choose the accounts tab. If you have already added your iCloud account then remove it and add it again.

  • I have the 4s and my texts are being sent out by my email...not my cell

    I have the 4s and my texts are being sent out by my email...not my cell

    Hi,
    1. Go into Settings
    2. Messages
    3. Send and Receive
    4. Start conversations from > Tap you phone number
    Cheers

  • I am having bugs with the ios 5, after it got the update it is unable to make outgoing calls. in-place the incoming and outgoing texts are working please help me asap...!

    i am having bugs with the ios 5, after it got the update it is unable to make outgoing calls. in-place the incoming and outgoing texts are working please help me asap...!

    Sometimes and this is network dependant if they suspect the phone to be lost or stolen as in this case with change of Sim card and provider then the origonal network can and some will block the phone untill you have rang them and proven it's not the case or if you have bough this 2nd hand then the origonal seller may have stopped paying the contract bill and thus the phone is blocked

  • Hi there. I having a problem with InDesign PDF interactive export. I would keep my text area style and not text area default style when I export the PDF. How could I do?

    Could you help me?

    Thanks for the answer Sumit Singh,
    sorry but my problem keeps.
    I create a simple text area and then trasform it in interactive text area, set it, apply my paragraph/character style and at the end export it in PDF (interactive).
    I open the file with Adobe Acrobat, but when I customize it, words inside text area have stylized with default paragraph/character style.
    How could I keep my style on export interactive text area?
    Thanks a lot.

  • Popup screen with two check box and a text area for the user to enter value

    hi,
    i have a requirement when a button is clicked a popup screen should appear with two check box and a text box where the user can enter a value.
    is there any function module which has that functionality

    Hello,
    You can create a new screen and select the screen type as <b>model dialog box</b>.This will give you a<b> pop-up screen</b> and you can call this model dialog box screen in the PAI of the screen where the button is present.(At user-command).
    <b>case ok_code.
    when 'BUTTON'.
    call screen 200 starting at 10 10.</b>
    You can design the PBO of this pop-up screen as per your needs.
    Regards,
    Beejal
    **Reward if this helps.

  • Help! Mail menus and icon text are all showing in Chinese/Asian characters!

    I am helping someone with their iMac G5 computer. A couple of days ago, all of a sudden the Mail program (v. 2.13) has all the menus, icon text, and mail folder descriptions (Inbox, Trash, Drafts, Sent, etc.) all showing in what looks to be Chinese (or other oriental language). I checked in System Prefs and language still set to US. None of the other program menus or text seem to be effected--just Mail. Anyone know what caused this or how to fix?? Thanks!

    Thanks for your reply. I am looking at the links you posted, but the problem here seems different. If you go into Mail, in the menu at the top, the word Mail is in English, then all of the other menu choices are written in what definitely appears to be an oriental language. If you click on a menu, all of the choices in the drop down menu are also oriental language. The e-mails themselves are in English, however the date of the e-mail is showing in oriental. On the left side, the words Inbox, Trash, etc. are all written in oriental as are the words under the icons. And, it's only in Mail. It just started doing this yesterday and the computer owner doesn't know why.
    Thanks so much for any further ideas/suggestions. I am going back to read more in the links you sent, but this seems a different problem.

  • Texts are not showing up after upgrading to version 11

    Could someone help me with why some of my texts are not show up on my Flash project? Before the upgrade, everything is fine. However, after upgrading to version 11, my texts are disappearing.
    Before (version 10.3.183.7...)
    After (version 11.0.1.152...)
    The texts in the boxes will disappear, when I hover mouse cursor over it. Those boxes with texts in them are created with an external AS file, and the texts are dynamicaly changed/put in with an external XML file. There is a mask on the boxes, show only 4 at a time.
    Demo: www.ethanslin.com/portfolioWorks/flashWorks/demo/
    You will see the changes with Flash player version 11, and everything working fine with older versions.
    I use iMacs with Snow Leopard and Lion, and this happens on all of the browsers with Flash Player version 11.01.152. I also tested on Windows 7, and it is still happening. Is this a Flash Player bug or something changed that I am not aware of? Is there a work around for this?

    This is a known issue and we have a fix for this in our next release. Thanks for posting.

  • Need to compare html text area values by using java script

    I have one html text area in my JSP file. when i click on that text area, a pop-up will come, in that pop-up i have list of items. So after selecting a item from that pop-up list, need to click okay. so that text area will update with the selected value.
    In this case, i need to compare the first text area value and updated text area value. How can i do that in Java Script.

    I suggest you look for a Javascript forum to ask questions about Javascript. This is a Java forum.

  • PO Header Texts and item texts

    Dear Experts
                        PO header texts and item texts are stored in which table. please tell me the table name.
    Here i have configured PO version management. in that i want to control some sensitive fields change only version management will get triggered. it is done through  for this i have configured the sensitive fields in PO Print relevant changes. in that config the PO header texts and item texts table and field name is not exist.
    Now i have change the PO through me22n in header texts version management is triggered for this. i want to control this if some body change the po header texts and item texts version management should not triggered.
    is it possible.
    Regards
    Anand.

    Hai,
    Try this  table STXH.
    Get the required information(input) for the function module 'READ_TEXT'.
    CALL FUNCTION 'READ_TEXT'
          EXPORTING
            ID                            = 'ST'
            LANGUAGE                      = sy-langu
            NAME                          = thead-tdname
            OBJECT                        = 'TEXT'     
        ARCHIVE_HANDLE                = 0
        LOCAL_CAT                     = ' '
      IMPORTING
        HEADER                        =
          TABLES
            LINES                         = lines
         EXCEPTIONS
           ID                            = 1
           LANGUAGE                      = 2
           NAME                          = 3
           NOT_FOUND                     = 4
           OBJECT                        = 5
           REFERENCE_CHECK               = 6
           WRONG_ACCESS_TO_ARCHIVE       = 7
           OTHERS                        = 8
        if sy-subrc eq 0.
          loop at lines.
            wa_HEADER_TEXTS-TEXT_FORM = lines-TDFORMAT.
            wa_HEADER_TEXTS-TEXT_LINE = lines-TDLINE.
            append wa_HEADER_TEXTS to lt_tmp_HEADER_TEXTS.
          endloop.
    Better take the help of abaper.
    With Regards,
    Jaheer

  • Ideas for huge text area

    Our Document Control person catalogs documents in a form I've created. We are a spice manufacturer (ahhhh, but alas, I can't smell them anymore while here! )  In one text area on the form she lists associated items, for example PL-1234 is a pallet layout for all of our jars, so that text area for document PL-1234 might have eighty item numbers, each five or six chars listed in the field. In addition, there are verification sheets, assembly instructions, work instructions, all catalogued, and all with that associated items field holding many many many item numbers.  Production workers on the floor then will enter the item number that they are making for the day and a list of all the documents they need for producing the item will display in an interactive report, where they will then call up those they need (touch screens to boot!!).
    I've never liked this solution but she wanted to be able to copy and paste into the list from another source [WARNING WARNING DATA CONSISTENCY NIGHTMARE!! - spaces, dashes, commas, yeah yeah, I know].  Recently, when we did a version upgrade, I realized I had truncated the field when I exported to Excel and the text area got chopped (thankfully less than ten and easily fixable), not at exactly 1024 chars, but something in that random neighborhood.  Before you fall off your chair laughing or roll your eyes at my naiveté-learn-as-I-go education, I'm looking for another way to handle this clump of data.
    I have collections on the form, which was how I wanted to handle this a few years ago when I created it, then she'd have to enter those items manually, and the potential of inaccuracies is huge.  So I'm thinking I should just continue to let her enter those items in the same manner, then reformat it and plunk it into a table that joins to the document table.
    I apologize for not having the jargon.  I hope this makes sense.  Thanks in advance for any suggestions you see fit.
    Alexandra
    Application Express 4.2.2.00.11
    Edit 1
    Not only the above, but in the interactive report, as far as I've always known, that associated items field must be visible on the interactive report with allllllllllllll those items listed for it to be searched by the production floor. Please advise.
    Edit 2
    Just an example of the bald spots on my head: 430922 42181 &lt;- 42182 &lt;- 42183 &lt;- 42184 &lt;- 42186 &lt;- 42188 &lt;- 42190 &lt;- 42192 &lt;- 42194 &lt;-

    4000 characters is the limit you should be seeing, not 1024 (unless that is the size of the column in your table)
    There is a DB Parameter for 12c that should jump that up to 32k
    If it really is a 4000 character limit, there is a plugin that can help out: - Dynamic Action Plugin - Enkitec CLOB Load
    I can't advise you on the 1st edit.  not enough info (a 'sample' on apex.oracle.com would be nice)
    For processing, you'll need to read a lot of fantastically written manuals:
    use (??does apex have something)/UTL_URL  to change HTML code like "&lt;" into "<"
    you may need to use DBMS_LOB and LOOP over the CLOB in 4000 byte chunks.
    use REGEXP_REPLACE to add hair back to your head (ie convert commas and spaces to single tab, remove nonsense characters, etc.)
    use APEX_UTIL.string_to_table() to convert the entries in a table-like format.
    make sure that the above is reusable as you'll want to use it once for Validation and once for Processing
    use FORALL to professionally bulk-insert the results into a child table
    use LISTAGG in your SELECT statements to convert the Relational version of the data back into something that looks like what was entered.
    use CREATE PACKAGE so you don't go insane in the future.  This is a lot of code to write.
    use SQL Developer to actually develop the PL/SQL code
    use a code repository like SVN so you can 'rollback' your new-and-imporved-but-buggy versions.
    and, most importantly, use sufficient comments and APEX_DEBUG.MESSAGE() in your code so that future developers can pickup where you stopped.

  • Can a script manually insert a delete (or backspace) into a text area?

    I'm new to action script, so this may have a simple answer, sorry if that's the case.
    I have a little movie created with a simple purpose of trying to mimic a system like cell phones have for character input.
    There are two text areas, one hidden off the screen that accepts the input from the user; a second text area in on screen and displays what the user had entered after some basic processing on the input.
    The hidden text area is pretty basic with listener that is responsible for grabbing the input keys and then mangling them to be inserted into the displayed text area based on the cell phone text entry multi-tap rules. Example user press 2-2-2  and the hidden input accepts 222 and then appends 'C' to the display text area. That's working great, but I have a problem if the user wants to delete from the display text area. I can't find a way to insert a delete or backspace key into the display text area. I've tried using StringFromCharCode (8) // Key.BACKSPACE, but that doesn't work. That just displays one of those undefined glyphs. I figure that things like clear, and delete are handled somewhere higher in the input chain and that's where I'm having a problem.
    I've looked, but I can't find a way to delete a single character from the text area. I was thinking if I could find the cursor location that I could just use some delete character method to get the job done, but I couldn't find how to do that.
    Any ideas on how to pull off manual delete function in a text area?

    Ned, I do really want to manually (by method of code) trigger a delete in a text area. The delete (or backspace) that I want added to the text area isn't directly entered by the user, it's the result of several key presses by the user. That's why I called it "manual" because it's done by the code, not by the user's direct input.
    Think about how text entry works on most phones... if you want to enter a letter you have to cycle through all the letters on a single key until you get to the character desired. As I stated before, if you want a 'c' you need to press 2 button 3 times. This is basically what I'm trying to do, but I want to add the ability to delete a character too if the correct sequence in entered, for example a sequence of ### would equal a backspace.
    Rothrock, I think you were thinking the same thing that a single key is used to do a backspace.
    I was thinking that I could possibly insert key event into the event queue for the text area to process, but I wasn't sure about that.
    Sorry, if this is confusing, I know it's not a straight forward design. I need onscreen and offscreen text areas with the onscreen one acting as a slave of the offscreen one.
    The way the code currently works is hidden text area had a listner that responds to changes, and that handler processes the key entered and deletes that character from the hidden text area. After the full sequence of characters (say 2 button has been pressed 3 times) the handler then sends the resulting character into the display text area. This part of the code works great. I can add any character including some specials like tab and newline. However if I want the text area to delete a character I don't have a way to do that. That's why I tried to insert the backspace key (0x08 or ^H, for other oldschoolers), but using that as a char code or string from char code doesn't work.
    I had also tried to create to set the focus to the display text area then create and dispatch a backspace keydown and keyup events to the visible text area and then return the focus back to the hidden textarea, but... no luck.

  • JMenuItem showing but behind a text area

    Hello, one of my JMenuItems is not able to be viewed correctly because it overlaps a text area and the text area is I guess shown over the top of it. Is there a way to have the JMenuItem be shown on top of the text area? This seems simple but I looked at the API's and couldn't find a method that would work.

    Okay, here is the code:
    JPanel right;
    JTextArea results;
    JScrollPanel scroll;
    right = new JPanel();
    results = new JTextArea();
    results.setSize(500, 500);
    results.setEditable(false);
    scroll = new JScrollPane(results);
    scroll.setWheelScrollingEnabled(true);
    scroll.add(results);
    right.add(scroll);Now I have all swing but the JScrollPane and JTextArea are like one white dot on my gui.

  • Creation of short text and long text?

    Hi,
    We create short text by using oe_fnd_attachments_pub.create_short_text_document and oe_fnd_attachments_pub.add_attachment API and to create long text we use fnd_documents_pkg.insert_row .
    Why is it that we have different approaches for creation of short text and long text?
    I know that oe_fnd_attachments_pub.add_attachment is used to attach a short text to some entity,but then why we dont do the same for long text?
    Please lemme knw urgently ...
    Thanks and Regards
    Amar

    Thanks for the help,
    I looked into the document and i got to know few things as to how short and long text are created, but can u tell when the records are inserted into fnd_attached_documents, because i can see that records are inserted into fnd_attached_short_text and fnd_attached_long_text, fnd_documents but i dont see any insertion into fnd_attached_documents, can u lemme knw how and when it is done?

  • JOptionDialog - add a text area

    is there a way to add a disabled JTextArea to a JOptionDialog?
    (I want to have a scrollable text area since I have a lot of text to show - and JDOptionDialog has it all in place already - an Icon, buttons and such...)
    or is writing my own Dialog the only solution?

    In the API documentation for JOptionPane.showxxxDialog, you'll see that one of the parameters you can use is "Object message" This Object can be something besides a String. For example, a panel with a label and a text area.          JTextArea ta = new JTextArea("Some text");
              JLabel label = new JLabel("some label");
              JPanel p = new JPanel();
              p.add(label);
              p.add(ta);
              String result = JOptionPane.showInputDialog(null,p);

Maybe you are looking for

  • Problem with safari on new i phone

    i am having a problem with safari on my new i phone the address bar is covering up some of the top of the web page and it will not let me scroll up any more has any els had this problem and can any on help

  • Error deploying Jdeveloper 10.1.3 ADF application on oracleAS 10.1.2

    Hi, i have created an application on Jdeveloper 10.1.3 and when i am trying to deploy it on oracleAS 10.1.2 i get the following error:- java.rmi.RemoteException deploy failed!: ; nested exception is: oracle.oc4j.admin.internal.DeployerException: Unkn

  • How Do I Unlock the full potential of my NVIDIA card

    I have a macbook pro with Nvidia 256mb. The original advert before I purchased says that it was divided into two parts and that you could unlock the potential of the second part if you needed more power. Could someone please clue me in on how to do t

  • Discoverer BI for OLAP "read-only" privilege problem

    Hello! I set the user privilege to "read-only" but still it allows me to save and edit the report within the user. I'm expecting to read only the report and not to modify it. Please let me do know if you have a solution for this. Grace

  • Need Best Practice - Apex, multiple schemas, security model

    We have an oracle database which contains a) named database users with no objects b) several schemas with data tables: sales marketing accounting We need to build GUI for tables in these schemas, every database users should belong to a group, each us