Cannot receive data from telnet - returns ioexception on read either by ...

Well, i need to connect to a telnet port.
After we have connected (just the socket connection), the telnet responds to us.
I need to record this response.
i tried to use both buffered input, as well as inputstream, but i fail to read, as it throws an ioexception.
Also i tried to find out the number of bytes that are responded by the telnet, surprisingly, it says that 21 bytes have been responded.
Here is my code :
public class TelnetClient implements Runnable {
private String userName, password;
private String cmdString = "ls", line;
private Socket telnetSocket;
private byte buff[];
private BufferedReader br;
private InputStream inStream;
private OutputStream outStream;
private InetAddress ipAddress;
private int port = 23;
private MainMenu mm;
private boolean sessionClosed = false;
/** Creates a new instance of TelnetClient */
public TelnetClient() {
public TelnetClient(String ipAdd, String uName, String pass) {
try {
this.ipAddress = InetAddress.getByName(ipAdd);
this.userName = uName;
this.password = pass;
}catch(UnknownHostException uhe) {
System.out.println("Cannot Reach to port : " + port);
public void run() {
try {
int i;
telnetSocket = new Socket(ipAddress, port);
telnetSocket.setSoTimeout(5000);
System.out.println("Established connection to port : " + port);
outStream = telnetSocket.getOutputStream();
inStream = telnetSocket.getInputStream();
br = new BufferedReader(new InputStreamReader(telnetSocket.getInputStream()));
// Thread.sleep(5000);
// outStream.write(userName.getBytes());
// Thread.sleep(5000);
// outStream.write(password.getBytes());
// Thread.sleep(5000);
// buff = cmdString.getBytes();
// outStream.write(buff);
Thread.sleep(5000);
int count = inStream.available();
System.out.println("Number of Bytes Replied : "+count);
// while((i = inStream.read()) != -1) {
// while((line = br.readLine()) != null) {           
inStream.read(buff);
System.out.print(buff);
telnetSocket.close();
}catch(UnknownHostException uhe) {
System.out.println("No Connection to port : " + port);
}catch(IOException ioe) {
System.out.println("Cannot Read from port : " + port);
ioe.printStackTrace();
catch(InterruptedException ie) {
System.out.println("Thread Interrupted !");
Please help me out, its really urgent and i need to sort this out quickly.
At present this port is on my PC and later i have to make such a connection to a remote unix server thu this application.
I am running a Windows Machine. and using netbeans IDE for development.
Thank You..

I posted a simple Telnet client that runs a command on a Unix server. You can find it in reply 7 of Telnet to Unix box from Java app.
If all you need is to run a simple command it should be sufficient. Otherwise you might want to take a look at Jakarta commons Net

Similar Messages

  • Traded in my iPhone for a different brand of phone. I had no idea that I had to sign out of iMessage before doing this. Now, my old phone is gone and my new phone cannot receive texts from people who have iphones and had me as a contact before. They try t

    Traded in my iPhone for a different brand of phone. I had no idea that I had to sign out of iMessage before doing this. Now, my old phone is gone and my new phone cannot receive texts from people who have iphones and had me as a contact before. They try to send an iMessage and I have no way to receive an iMessgae now. On some server somwhere my AppleID still tells people they should send me iMessages. What is the solution to this issue? Deleting my AppleID would work to solve this issue, but I cannot ever delete the ID? What can Apple do for this?

    If you did not erase your apps and data before getting rid of your old phone, try using Find My Phone and erasing everything remotely. See if this works.

  • P6 Analytics - cannot load data from STAR database in BI EE

    Hi.
    We have successfully deployed OBI EE 11g and STAR database (RDB 3.1), ETL processes have also run succesfully. But we cannot access data from the Analytics in a very strange way: we can get information on EPS and WBS, but cannot get projects or activitites data. It doesn't show any errors, it just returns empty replies (including replies on SQL-queries in Administration->SQL). I have cleaned the cache (call SAPurgeAllCache()) and reloaded metadata. I've checked the STAR db - all the data is ok.

    Check in P6 application that you have given access to P6 Analytics module to the application user. If not give that and rerun Global Schedule services followed by ETL process.
    This appears to be related to security but I might be wrong.

  • Receive data from PayPal

    Hello.
    Assuming that I send data into PayPal (with the use of  "HTML Variables for PayPal Payments Standard"):
    var variables:URLVariables = new URLVariables();
    variables.cmd = "_xclick";
    variables.business = "A8AJGG5PS2GKE";
    variables.upload = "1";
    variables.item_name = "some item";
    variables.amount = "123";
    variables.currency_code = "USD";
    variables.lc = "pl";
    variables.page_style = "PayPal";
    variables.return = "my site";
    variables.re = 2;
    variables.no_note = 1;
    variables.no_shipping = 1;
    variables.notify_url = "[email protected]";
    var request:URLRequest = new URLRequest("https://www.paypal.com/cgi-bin/webscr");
    request.method = URLRequestMethod.POST;
    request.data = variables;
    navigateToURL(request, "_blank");
    Does anyone managed to integrate PayPal IPN - "Instant Payment Notification"-
    (https://www.paypal.com/ipn/) with AS3 in order to receive data from PayPal?
    Could you please show any example of using it.

    My idea is as follow:
    1. .swf on you page sends variables into PayPal
    2. After finishing the payment on PayPal, the customer is auto-redirected to your page ("return" variable)
    3. Customer returns to your page. PayPal does NOT send any payment data there.
    Separately in the background, you receive a form POST from PayPal at a different URL (notify_url variable) - (here resides the php that I added below).
    4. You post back a form with cmd=_notify-validate and all fields you received from PayPal. PayPal responds with a single word VERIFIED or INVALID
    5. If you receive VERIFIED, you can process payment
    This method means that you can easily update for example your MySQL database but unfortunately you have to reload .swf file each time - and that's why it is not a perfect solution in my opinion;
    PS:
    - variables.return   and variables.notify_url must be absolute urls
    - notify_url must also allow anonymous access from outside of your network
    - firewall must be opened to host: notify.paypal.com
    - in your business PayPal account:
    Auto Return = Enabled in account profile
    PDT = Disabled in account profile
    IPN = Enabled in account profile
    - php file:
    <?php
    // read the post from PayPal system and add 'cmd'
    $req = 'cmd=' . urlencode('_notify-validate');
    foreach ($_POST as $key => $value) {
            $value = urlencode(stripslashes($value));
            $req .= "&$key=$value";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, 'https://www.paypal.com/cgi-bin/webscr');
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $req);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Host: www.paypal.com'));
    $res = curl_exec($ch);
    curl_close($ch);
    // assign posted variables to local variables
    $item_name = $_POST['item_name'];
    $item_number = $_POST['item_number'];
    $payment_status = $_POST['payment_status'];
    $payment_amount = $_POST['mc_gross'];
    $payment_currency = $_POST['mc_currency'];
    $txn_id = $_POST['txn_id'];
    $receiver_email = $_POST['receiver_email'];
    $payer_email = $_POST['payer_email'];
    if (strcmp ($res, "VERIFIED") == 0) {
            // process payment
    else if (strcmp ($res, "INVALID") == 0) {
            // log for manual investigation
    ?>

  • How to use sda6810 to receive data from a rs485 channel?

    I want to use sda6810 to anlyze data from a rs485 bus. So I use Labview to progame the sda6810 with the drivers.Firstly,I intilite the card,then I cofigued an channel to send data from a buffer,and configued another channel to receive data from the first chanel . But unfortunatly the data I received was not equal to the data I sended.And there are not any error messages indicated in Labview
    And when I try to use the GP channel,I found it worked properly.please tell me how I can solve the problem?

    I really apreciate your help.You told me that
    I should use the exameples which shipped with sda driver firstly. I do used them,and it worked correctly.So I think the connections was being setup properly.And I
    used labview to progame the rs485 channel
    . It do received something .But it was incorrect.
    I would be grateful if you could send me an
    example writted by labview,or you could tell
    me you e-mail address.
    Here is my code .
    Attachments:
    youyou2.zip ‏110 KB

  • Partner Profile type : Receiving Data from an 3rd party sys & Posting IDoc

    Hi all,
    My scenario is Receiving Data from a third party system and sending it to a R3 system as an IDoc...
    It is a B2B scenario.....
    So please tell me what should be my Scheme for the indentifier that i will be mentioning in the sender party...
    Should it be ALE#KU or ALE#LS.........
    it is working fine with ALE#KU...i m getting an error if i define it as ALE#LS......
    Is there an extra setting that should be done for configuring it as ALE#LS or , it is not possible configuring using ALE#LS
    Thanks in Advance,
    Sushil H.

    Hi Sushil,
    I have a similar problem and opened a thread: Unable to convert the sender service ABC_Service to an ALE logical system
    i was able to do it without specifying any identifier ...and mapping the sender information in the message mapping,,,,
    Can you please tell me:
    1) What value you specified in the mapping for sender (was it 3rd party/ PI/ R3)? Did you disable the other fields like RCVPRN/ RCVPOR etc?
    2) Did you make any change in the receiver channel for IDOC (in identifier section)?
    It will be very helpful to me if you reply.
    Thank you,
    Pankaj.

  • My phone cannot receive file from pc using bluetoo...

    I got problem with my phone that cannot receiving file from my pc via bluetooth,
    but there's no any trouble if i send or receiveing file from other mobile phone,
    someone please explain and give me the solution

    I'm using nokia 5530 XM

  • I cannot receive text from anyone that is not on an iPhone...

    i cannot receive text from anyone that is not on an iPhone...

    sorry i just edited.  i can receive text from other carriers, other phones, but cannot receive from iphones. 
    i rececently switched to a 5 AND added one for my daughter on her own number but same apple id. i dont have her phone nearby to see what she may have possibly changed.

  • Cannot Receive Text from One Person

    I cannot receive texts from 1 person who is also a Verizon Customer, both of us have iPhone 4S phones.  I receive his messages on my iPad, but not my iPhone.   All other texting seems to be working with other contacts.  I could receive his texts/iMessages 12 hours ago without a problem.  Any suggestions?  I have rebooted my phone.  He can receive my texts.
    Thanks.

    I'm having a similar problem. I can receive texts from this one person but he cannot receive mine. I can also not call him but he can call me. He uses A T&T but does not have this problem when texting other verizon users. I have an Iphone 4S and he has an Iphone 5. This has been happening for 3 days. I have tried resetting the networks, restarting my phone,  and checking blocked contacts. Nothing is helping with the issue.

  • HT201269 how do i unregister my iphone? I have the galaxy s4 now and cannot receive texts from iphone users.

    How do i unregister my old Iphone, i no longer have it in my possesion. I now have the galaxy s4 and cannot receive texts from iphone users

    Hello AnnH2
    If you have access you your old iPhone, just sign out of Messages. If you do not have access to it, then change your Apple ID password.
    iOS and OS X: Link your phone number and Apple ID for use with FaceTime and iMessage
    http://support.apple.com/kb/HT5538
    Unlink a phone number
    To remove a phone number from an Apple ID, sign out of FaceTime and Messages on your iPhone:
    Settings > Messages > Send & Receive. Tap your Apple ID, then tap Sign Out.
    Settings > FaceTime. Tap your Apple ID, then tap Sign Out.
    This should remove your phone number from other devices using the same Apple ID with FaceTime and Messages. If the phone number is still available on other devices after you sign out of FaceTime and iMessage on the iPhone, you may need to sign out of iMessage and FaceTime on all your devices, then sign in to FaceTime and Messages again on devices you want to use.
    Note: If you no longer have access to the iPhone that is using the number you want to remove, reset your Apple ID password.
    Regards,
    -Norm G.

  • I recently bought a Samsung Galaxy s5 and cannot receive iMessages from iphones, I have deleted my apple id, turned off imessage, turned off spam messages on my android device, wasted 35 minutes on the phone to Apple's 'Support' has anyone got any tips?

    I recently bought a Samsung Galaxy s5 and cannot receive iMessages from iphones, I have deleted my apple id, turned off imessage, turned off spam messages on my android device, wasted 35 minutes on the phone to Apple's 'Support' has anyone got any tips?

    Hi,
    Do you mean you are not getting SMS text messages now ?
    If so start here
    Follow the Account management options until you are offered and email contact.
    Explain the issue via email as only someone in Support can now remove your iPhone Number from iMessages if it has not "de-registered" itself correctly.
    8:28 pm      Wednesday; May 7, 2014
    ​  iMac 2.5Ghz i5 2011 (Mavericks 10.9)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad

  • Switched from 9900 to q10 and a particular i cannot receive messages from a particular bbm pin

    switched from 9900 to q10  and a particular i cannot receive messages from a particular bbm pin
    the messages are not being delivered to me from a particular pin

    Can you send messages to that particular pin?
    Click if you want to Thank someone. If Problem is resolved, so that others can make use of it.

  • I cannot receive texts from one contact after updating to the iOS7 system - why?

    I cannot receive texts from one contact after updating to the iOS7 system - why?

    amyhs, thanks for those details. This is certainly quite odd that this has been going on so long and we definitely want to get to the bottom of this. Now, you stated that you have reached out to technical support and spoke with a tier two technical support representative. At this time, what actions or troubleshooting steps were taken? Are you aware if a ticket with our network technicians was ever created? As well, have you ever previously had an iPhone and are you aware if the users that are unable to message you are using iMessage?
    AdamG_VZW
    Follow us on Twitter @VZWSupport
    If my response answered your question please click the "Correct Answer" button under my response. This ensures others can benefit from our conversation. Thanks in advance for your help with this!!

  • Cannot receive fax from one telephone number

    I cannot receive faxes from one specific party, connects and then says it fails to receive.

    Hi,
    Please check the sender to see is it a silence number ? or using any filter ?
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Gnome-Bluetooth cannot receive files from Nokia Lumia 810

    To whom it may concern,
    I opened a  bug report stating that I cannot receive files from my Nokia Lumia 810 using gnome-bluetooth. According to Nokia, it should be able to (and they claimed they tested it themselves during my phone call with them). The bug report is FS#33348. I'd appreciate if anyone could assist me on this problem.

    jainkkunal wrote:
    This link has been deleted could you please post the solution here Thanks in anticipation
    Hi and Welcome to the Forums!
    See this KB:
    KB05409 Transfer a file using Bluetooth technology between two BlackBerry smartphones
    Substitute, in the KB, the appropriate instructions for your other device in place of the KB section for the sending device. Do not skip the "Receive Using BT" step on the receiving BB...nothing will transfer if you do.
    Good luck and let us know!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

Maybe you are looking for

  • How do I get google talk to accept my password when using imessage?

    I have both a MacBook Air and Pro using iOS X - Maverick.  For the longest I have not been able to use iMessage with Google Talk.  I need to be on Google Talk for work and decided to set it up.  I set it up, but when I shut it down and then re-open i

  • To Whom want to be helped using  the webutil_102 Jacob_17 Form9i  builder

    Steps Running WEBUTIL Comes With 9i 1) File Distibution;      After I unzipped the file webutil_102.ZIP; I distributed the file as follow      In D:\Dev9i\forms90\java I have the following file: webutil.jar, jacob.jar,      In C:\webutil\lib, I ha

  • Automating meta data changes

    Hi. This is my first time trying to automate something like this, so any help is greatly appreciated. I have about 1000 jpeg files and a text file that lists each file name followed by a title, date, etc... I am looking for a way to automatically wri

  • Publish web services with SAP 7.1

    hello everybody, i'm working with a sap installation netweaver 7.1 i want publish some functions as web services. I made it many time with NW 7.0 without problem. At the moment i'm using the same procedure: SE37 - function name - Utilities - create w

  • Convert xml file to fmb (very urgent)

    We have application based on oracle forms version 10gr1 (9.0.4.1). We want to migrate to oracle forms 10gr2. We are using windows 2003.When I trying running command line <oracle_home>\bin\frmxml2f.bat userid=.../...@.. sample_fmb.xml overwrite=yes I