Please help: DataInputStream doesn't return response for remote device

Hi all,
Please advise what is my mistake.
I am about to send a command to and get respond from my embedded kit (Arduino Wiznet Wifi Kit)
I can send command and get respond through a Telnet.
But i can only send command but not getting respond if i am about to write a java program to do the same thing with socket programming.
Below is my code, please advise for my mistake.
Many thanks!
public static void startTCPCommunication(String ip) throws UnknownHostException, IOException{
     InetAddress thoseIp = InetAddress.getByName(ip);
     // IO streams
     DataOutputStream toServer;
     DataInputStream fromServer;
     String entered=""; // Declare & initialize a String to hold input.
     Scanner input=new Scanner(System.in); // Decl. & init. a Scanner.
     try {
          System.out.println("Socket created");
          Socket socket = new Socket(ip, 5000);
          // Create an input stream to receive data from the server
          fromServer = new DataInputStream(socket.getInputStream());
          // Create an output stream to send data to the server
          toServer = new DataOutputStream(socket.getOutputStream());
          while(true){
               System.out.println("Please enter : ");
               entered=input.nextLine(); // Get what the user types.
               // Then say something trollish and use their name.
               System.out.println("You have entered : " + entered + "!");
               // Send the command to the server
               toServer.writeUTF(entered);
               System.out.println("Done with Send");
// Get the response from server
               String response = fromServer.readUTF();
               System.out.println("Retruned : " + response);
     catch (IOException ex) {
     System.out.println("Unable to create socket.");
The returned result only reaches System.out.println("Done with Send");
The function stucked and not going to loop for second time.
Please advise how can i modify my code and pin point my mistake please.
Thanks a lot!

                   // Send the command to the server
                   toServer.writeUTF(entered);
                   System.out.println("Done with Send");
// Get the response from server
                   String response = fromServer.readUTF();
                   System.out.println("Retruned : " + response);Check the Javadoc. writeUTF() doesn't send anything a Telnet server will understand, and a Telnet doesn't send anything that readUTF() will understand. They only understand each other. Use write(), and append a newline.

Similar Messages

  • PLEASE help!! I use Outlook for my email and the Mail App Icon in my dock was also storing all my emails. So, I tried to delete ONLY the emails in the Mail App but somehow (under Preferences maybe?) I also deleted all my emails in my Outlook inbox.

    PLEASE help!! I use Outlook for my email and the Mail App Icon that is in my dock, that I know nothing about, was also storing all my emails. So, I tried to delete ONLY the emails in the Mail App but somehow (under Preferences maybe?) I also deleted ALL my OUTLOOK emails in my inbox.  Can someone please please tell me if there is a way to get my Outlook inbox emails back OR EVEN the emails that were in my Mail app - because even tho I never use the Mail app, at least the emails would be there.
    When I was trying to delete the emails in my inbox for the Mail app - I followed THESE directions.  It did in fact clear my inbox for the Mail app.  But then I went to log on to my Outlook account and EVERY SINGLE EMAIL was gone.  And not in the Deleted box.  Just gone.  Here are the directions I followed that screwed everything up.  Please help.
    Top menu bar, Mail > Preferences > Accounts > Mailbox Behaviors.
    Uncheck "Store deleted messages on the server".
    At the drop list for "Permanently erase deleted messages when", choose "Quitting Mail".
    Next...
    Top menu bar, Mail > Preferences > General.
    At "When searching all mailboxes, include results from", uncheck "Trash".
    Select All = command A

    i found out my prob!
    here is what you do.
    go to the "system preferences" on your dock.
    click "software updates".
    click "installed software"
    if it shows something about a recent update about "EFI UPDATE, FIRMWARE, THUNDERBOLT" or anything like that, exit out of it.
    go to mail.
    click "mail" at the top.
    click "preferences...".
    find the account you are having trouble with, once you do, make sure its highlighted, then click the "-" at the bottom of the window (this will only effect that mail account, it will not effect your ical weather or not its synced thought that email account)
    hit the "+" (right next to the "-") and add your accout back!
    its something with that update that effected mail, i hope this works out for you, if not reply back

  • Can a one please help me turn off auto play for Facebook the option is no longer in my  General settings  why is this ?

    Can a one please help me turn off auto play for Facebook the option is no longer in my  General settings  why is this ?

    And yet the link you posted only tells you how to do it on the Facebook App for Android. Nothing about the Facebook page is mentioned at all, or how to do it on an iPhone.
    With that said, and assuming you have the most up to date version of the Facebook App, you can now turn the auto play feature Off within the Facebook App itself.  Tap on the "More" icon on the bottom right, then scroll down to Settings->Videos and Photos->Auto Play. If Smart auto-Play is on turn it off. Then you can set the check mark on "Never Play Videos Automatically" which is the same as Off.

  • I have downloaded Photoshop Elements 12.  When I doubleclick on icon, it says that sign in is required.  I click sign in and it says I am not connected to the internet. Please help!  I've been trying for 3 days.

    I have downloaded Photoshop Elements 12.  When I doubleclick on icon, it says that sign in is required.  I click sign in and it says I am not connected to the internet. Please help!  I've been trying for 3 days.

    Sign in, activation, or connection errors | CS5.5 and later

  • HT201441 Please help me I forgot the password for iclaud I can not open the device I want a solution "

    please help me i forgot the password for my iclaoud  i can not open my the device

    Try to reset your password here: http://appleid.apple.com

  • Please help me with msi installer file for 11.6.8.* as this is our standard version which we use for all machines in our organization

    please help me with msi installer file for 11.6.8.* as this is our standard version which we use for all machines in our organization

    arai-c wrote:
    I have full version of this software but I am not able to install it silently because it always gives Google toolbar pop up which We dont required
    arai-c wrote:
    the problem is we dont have msi file for 10.6.*.* and hence I am not able to create package for it
    I don't understand; two days ago you wrote that you have it, now you don't...?
    If you don't have it, then why not deploy the current version 12.1.3.153 - I don't see the point of installing an old, unsecure software version.

  • Pls help me in sending sequential responses for the different commands.

    Hi all
    pls help me in  sending sequential responses for the different commands. For example,i have to send the response1 for command1 then again host wll send the some other command ,say command 2  after receiving response 1,then again i have to respond to the corresponding command.i m using the pci-6221 card not tradition DAQcard.
    regards,
    nitin

    Hi,
    you need to be more specific. What is your setup?
    Obviously, what you need is a command parser. Look this article for the basics. I know it is meant for RT but the concept is there.
    Not sure it will help with so few infos: http://zone.ni.com/devzone/conceptd.nsf/webmain/CD63FD0F746B17A686256F090065F572
    Dai
    Dai
    LV 7.1 - WIN XP - RT - FP

  • HT201412 my phone was charging and then it wouldnt turn back on and the lock button is jammed so i cant really do anything. please help me, i havent had it for very long.

    My phone was charging and then it wouldnt turn back on and the lock button is jammed so i cant really do anything. Please help me, i havent had it for very long.

    i put that i held down the home button and all that... sorry, should of made my message a little clearer hun.. but i did try that, ive been searching video's on the net trying to figure out how to fix the problem, but nothing seems to be working... ive just tried pluging the usb lead into my phone while holding the home button then connecting it to my computer to see if itunes fires up, but even that didnt work... i dont know what else to try.

  • HT201328 my iphone 4G buy from japan, i need to use in indonesian, please help me, i spent much money for this phone.....

    my iphone 4G buy from japan, i need to use in indonesian, please help me, i spent much money for this phone.....

    froggy_vic wrote:
    so even if your phone is unlocked you wouldn't be able to use it anywhere else.
    Absolutely not true. There is no difference, spec wise, between the iPhone sold in Japan & the GSM iPhone sold everywhere else. iPhones in Japan use UMTS 2100.

  • Please help me to find the table for fields where the descriptions are give

    please help me to find the table for fields where the descriptions are given below
    Customer Support Administrator
    first line Support indicator

    You could also try table DD01T. In se 16,put in the description thats needed,you will get to know the respective data elements.
    Then you can use DD03L to find the respective table. This would work if the data element is not generic.
    Regards,
    Anubhav.

  • Please help: Application doesn't work after upgrade to Workshop 8 sp2 from sp1

    Hi,
    Our application worked on workshop 8 sp1. After we upgrade system from sp1 to
    sp2, some of the part doesn't work propertly any more.
    1. netui:select seems not bind form data propertly. For drop down list box in
    forms, although user has chosen something from the drop down list box, the returned
    value in the form is always null.
    2. we use Java script window.open(url,...) to download and view files. After upgrade
    from sp1 to sp2, clients keep getting IE error complaining that "Internet Explore
    can not open this Internet site. The request site is either unavailable or can
    not be found. Please try again later", although the server and the files are all
    in local host server.
    Please help. Thanks

    Did you update your workshop application files and recompile your application?
    A few things changed between GA and sp2, some annotations were renamed, and some
    were added.
    If you open up your application in Workshop sp2, it should given you the option
    to upgrade your application.
    Failing that, you may need to go through the code that is not performing as it
    was before and check whether it was not utilising a bug that was fixed in sp2
    and thus causes it to not function correctly now.
    "Cynthia" <[email protected]> wrote:
    >
    Hi,
    Our application worked on workshop 8 sp1. After we upgrade system from
    sp1 to
    sp2, some of the part doesn't work propertly any more.
    1. netui:select seems not bind form data propertly. For drop down list
    box in
    forms, although user has chosen something from the drop down list box,
    the returned
    value in the form is always null.
    2. we use Java script window.open(url,...) to download and view files.
    After upgrade
    from sp1 to sp2, clients keep getting IE error complaining that "Internet
    Explore
    can not open this Internet site. The request site is either unavailable
    or can
    not be found. Please try again later", although the server and the files
    are all
    in local host server.
    Please help. Thanks

  • Please help me with the proper query for the below problem

    Hi,
    I have a table RATE which have two columns RT_DATE (date) and RATES(number).
    This table have following data.
    RT_DATE
    RATES
    1-JAN-2007
    7
    2-MAR-2008
    7.25
    5-JAN-2009
    8
    8-NOV-2009
    8.5
    9-JUN-2010
    9
    I wanted to get the rate of interest on 8-DEC-2009.
    Output will be 8.5 as this given date is in between 8-NOV-2009 and 9-JUN-2010. Could you please help me with proper query?
    Regards,
    Aparna S

    Hi,
    That sounds like a job for the LAST function:
    SELECT  MIN (rates) KEEP (DENSE_RANK LAST ORDER BY rt_date) AS eff_rate
    FROM    rate
    WHERE   rt_date < 1 + DATE '2009-12-08'
    MIN above means that, in case of a tie (that is, 2 or more rows with the exact same latest rt_date) the lowest rates from that latest rt_date will be returned.  In rt_date is unique, then it doesn't matter if you use MIN or MAX, but syntax demands that you use some aggregate function there.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for your sample data, and also post the results you want from that data.
    Point out where the statement above is getting the wrong results, and explain, using specific examples, how you get the right results from the given data in those places.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002#9362002

  • Please Help Urgent:Fast Search returning wrong result sets

    Hi All,
    We are facing below issue with fast search.
    Currently in My project  when  we are searching  for a phrase it is returning wrong result sets.
    For example if we search for “Endura”, It is returning documents related to
    Endura  as well as Centura.
    But the expected results are only Endura documents.
    When we look in to the documents we didn’t find the search term (“Endura” ) either inside document content or in its meta data.
    In order to resolve the issue we tried the below steps
    1-     
    We manually edited and saved the document, to ensure the appropriate Guid association to metadata.
    2-     
    Index reset
    3-     
    Full crawl
    But no luck  so far.
    Please help.Thanks in advance.
    Regards
    Subrat

    Subrat,
    This may be related to spellchecking or may be synonym. Spellcheck is based on indexed terms.
    The best test would be to run the queries from qrserver (13280) and then look at the spellcheck query transformations. If spellchecking is not doing it, then you must have a synonym setup .Check your keyword/synonyms from the SharePoint side. 

  • Disco Report doesn't return data for a responsibilty

    Hi Guys,
    We have a report, we have shared with XXX Tax Manager. When we login through XXX Tax Manager, it doesn`t return data. But when we do similer with XXX Payables Manager, report runs fine and return data?
    Can any one help me on this.
    Note: Both Responsibility have access to the Business Area.
    Thanks,
    Nick

    Please find the below query:
    SELECT /*+ NOREWRITE */
    o101613.expense_account_num AS e264170,
    o271954.description AS e271961, o271954.po_number AS e272013,
    o271954.project AS e272033, o271954.task AS e272035,
    o271954.expenditure_type AS e272036, o272183.amount AS e275461,
    (o272183.gl_date) AS e275566, (o272183.invoice_date) AS e275578,
    o272183.invoice_id AS e275580, o275448.invoice_id AS e275581,
    o272183.invoice_number AS e275584,
    o272183.self_assessed_flag AS e275674,
    o272183.ship_to_location_code AS e275681, o272183.state AS e275685,
    o272183.tax_amount AS e275695,
    o272183.tax_jurisdiction_code AS e275698,
    o272183.tax_rate AS e275700, o272183.vendor_name AS e275720,
    o272183.vendor_number AS e275723, (o278494.gl_date) AS e278500,
    o278494.liability_account AS e278501
    FROM apfg_ap_invoices o101612,
    apfg_ap_invoice_distributions o101613,
    apps.ap_invoice_lines_v o271954,
    (SELECT ap.invoice_id, aps.vendor_name, aps.segment1 vendor_number,
    ap.invoice_num invoice_number, ap.invoice_date, ap.gl_date,
    apl.amount amount, zxl.tax_amt tax_amount,
    zxr.percentage_rate tax_rate, zxl.tax_jurisdiction_code,
    apl.ship_to_location_code, zxl.self_assessed_flag,
    hzg.geography_element2_code state, apl.line_number
    FROM ap.ap_suppliers aps,
    ap.ap_invoices_all ap,
    zx.zx_lines zxl,
    apps.ap_invoice_lines_v apl,
    zx.zx_rates_b zxr,
    zx.zx_jurisdictions_tl zxj,
    zx.zx_jurisdictions_b zxb,
    ar.hz_geographies hzg
    WHERE aps.vendor_id = ap.vendor_id
    AND ap.invoice_id = zxl.trx_id
    AND zxl.trx_id = apl.invoice_id
    AND zxl.trx_line_number = apl.line_number
    AND zxl.entity_code = 'AP_INVOICES'
    AND zxl.event_class_code = 'STANDARD INVOICES'
    AND zxl.self_assessed_flag = 'Y'
    --AND zxr.tax_rate_code         = zxl.tax_rate_code
    AND zxr.tax_rate_id = zxl.tax_rate_id
    AND zxj.tax_jurisdiction_id = zxl.tax_jurisdiction_id
    AND zxb.tax_jurisdiction_id = zxj.tax_jurisdiction_id
    AND zxb.zone_geography_id = hzg.geography_id
    AND zxl.tax_amt <> 0
    AND apl.line_type_lookup_code IN
    ('ITEM', 'FREIGHT', 'MISCELLANEOUS')
    AND apl.line_source IN
    ('HEADER MATCH',
    'MANUAL LINE ENTRY',
    'IMPORTED',
    'CHRG ITEM MATCH'
    AND ap.cancelled_date IS NULL
    ORDER BY aps.vendor_name, ap.invoice_num) o272183,
    apps.ap_invoices_v o275448,
    (SELECT xte.source_id_int_1 invoice_id, gcc.code_combination_id,
    xte.transaction_number, xal.accounting_date gl_date,
    gcc.segment1
    || '.'
    || gcc.segment2
    || '.'
    || gcc.segment3
    || '.'
    || segment4
    || '.'
    || segment5
    || '.'
    || segment6
    || '.'
    || segment7 liability_account
    FROM xla.xla_transaction_entities xte,
    xla.xla_ae_headers xah,
    xla.xla_ae_lines xal,
    gl.gl_code_combinations gcc
    WHERE 1 = 1
    AND xte.entity_id = xah.entity_id
    AND xte.application_id = xah.application_id
    AND xah.ae_header_id = xal.ae_header_id
    AND xal.accounting_class_code = 'SELF_ASSESSED_TAX_LIAB'
    AND xal.code_combination_id = gcc.code_combination_id) o278494
    WHERE ( (o101612.invoice_id = o101613.invoice_id(+))
    AND ( o101613.invoice_id = o271954.invoice_id
    AND o101613.invoice_line_number = o271954.line_number
    AND ( o272183.invoice_id = o271954.invoice_id
    AND o272183.line_number = o271954.line_number
    AND (o272183.invoice_id = o275448.invoice_id)
    AND (o278494.invoice_id = o275448.invoice_id)
    AND (o101613.dist_line_type_code IN
    ('ITEM', 'FREIGHT', 'MISCELLANEOUS'')')
    AND (o101612.invoice_number = :"Invoice Number ")
    AND ((o272183.gl_date) <= :"Ending GL DATE")
    AND ((o272183.gl_date) >= :"Beginning GL DATE")
    ORDER BY o271954.project ASC, o272183.invoice_number ASC;
    It does not contain any security profiles, only contains view that might be not returning data.
    thanks

  • I have an Ipod 4th gen. and when you plug it into the wall it is stuck on the charge/lighting bolt screen and it wont charge, and when you plug it into a computer (PC) the lighting screen wont even apear. Please help I have had this problem for forever.

    I have a ipod touch 4th gen and it wont chrage. When you plug it into the wall the lightniing bolt screen will apear but no matter how long you leave it, it will never turn on. Also it the lightning bolt screen wont even come on when you plug it into a computer (PC)..........PLease help its been like this for forever

    Hi Gammer576775!
    Here is an article that will help you troubleshoot this issue with your iPod touch:
    iPod touch: Hardware troubleshooting
    http://support.apple.com/kb/ts2771
    Will not power on, or will not turn on unless connected to power
    Verify that the Sleep/Wake button functions. If it does not function, inspect it for signs of damage. If the button is damaged or is not functioning when pressed, seek service.
    Connect the iPod touch to an Apple USB power adapter and let it charge for at least ten minutes.
    After at least 15 minutes, if the display turns on and…
    The home screen appears, the device should be working. Continue charging it until it is completely charged and you see this battery icon in the upper-right corner of the screen: . Then disconnect the device from power. If it immediately turns off, seek service.
    The low-battery image appears even after the iPod touch has charged for at least 20 minutes: See the "iPod touch displays the low-battery image and is unresponsive" symptom in this article.
    Something other than the Home screen or low-battery image appears , continue with this article for further troubleshooting steps.
    If the iPod touch did not turn on, reset it while connected to an Apple USB power adapter. If the display turns on, go to step 4.If the display remains black, go to the next step.
    Restore the device. Connect it to a computer and open iTunes. If iTunes recognizes it and indicates that it is in recovery mode, attempt to restore the iPod touch. If the device doesn't appear in iTunes or if you have difficulties in restoring it, see this article for further assistance.
    If restoring the iPod touch resolved the issue, go to step 4. If restoring it did not solve the issue, seek service.
    Thanks for using the Apple Support Communities!
    Cheers,
    Braden

Maybe you are looking for