I need a solution for the deprecated readLine() method .

import java.io.*;
import java.net.*;
class UC {
public static void main(String args[]) throws Exception
DataInputStream inFromUser = new DataInputStream(System.in);
DatagramSocket clientSocket = new DatagramSocket();
InetAddress IPAddress = InetAddress.getByName("hostname");
byte[] sendData = new byte[1024];
byte[] receiveData = new byte[1024];
while(true)
String[] sentence = inFromUser.readLine(); /* It says the readLine() method is deprecated. what is the solution for this? */
          sentence.getSubstringBytes(sentence,0, sentence.length(), sendData, 0);
//sentence.getBytes(0, sentence.length(), sendData, 0);
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, 9876);
clientSocket.send(sendPacket);
DatagramPacket receivePacket
= new DatagramPacket(receiveData, receiveData.length);
clientSocket.receive(receivePacket);
String modifiedSentence =
new String(receivePacket.getData());
System.out.println("FROM SERVER:" + modifiedSentence);
     public void getSubstringBytes(String sentence,int space,int Size,byte[] sendData,int space)
               byte[] bytes=sentence.getBytes();
               System.arraycopy(bytes,0,sendData,0,sentence.length()-0);
}

Sorry, It should be the BufferedReader , not BufferedInputStream.

Similar Messages

  • I need a solution for the security questions please ?? In the other hand i can't use the rescue email !! I need help .

    I need help for those security questions please !! I don't have a rescue email and even i don't know how to add it ! Please help me

    I didn't mean to give me an answer for the security questions i mean that i didn't remember the answers and i don't have a rescue email to send in it , i'm just ask for sloution to reset my security questions got it?

  • Need a solution for the following error code on AIR-AP1231G-A-K9

    Dec 1 10:05:46.243: %DOT11-7-AUTH_FAILED: Station 0018.de89.d720 Authentication failed

    Hi
    Here you are the explanation:
    The specified station has failed authentication.
    The most common reasons are the user has entered the wrong password or the radius server maybe unavailable.
    Hope this helps

  • Need solution for the following sync error: "iTunes could not sync calendars to the iPad "iPad name" because an error occurred while sending data from the iPad"

    Need solution for the following sync error: "iTunes could not sync calendars to the iPad "iPad name" because an error occurred while sending data from the iPad"

    I want to add that I deleted all the old back-ups and created a new back-up without any issues except sync problem.

  • Need solution for the following(Selection Screen)

    Hi all,
    currently iam working with report program,there i need to populate one field in the selection screen based on the another parameter in the same selection screen.
    iam having field called work center as a parameter with the search help.
    This search help is providing the corresponding plant for the particular work center.
    Now what i need to do is,if i select the work center thru F4 help,i need the correseponding plant to get populated in the other textbox.
    Currently iam having that work center field as parameter,
    now i need another textbox for the plant adjacent to this workcenter textbox,in this textbox only i need that corresponding plant.
    Following is the code for that workcenter textbox.
    PARAMETERS:P_ARBPL LIKE CRHD-ARBPL MATCHCODE OBJECT CRAM.
    Note: The Serach help CRAM is having corresponding  plant with the workcenter.

    Hi swaminathan,
    1. If u want to DIRECTLY
       populate other fields
       based upon selection,
      then we have to use our own
      selection function.
    2. just copy paste this code in new program.
      ( it will display help for BUKRS
      and AS SOON AS the user selects some company code,
      the other fields
      get populated AUTOMATICALLY)
    3.
    REPORT abc.
    DATA : dd     LIKE     TABLE OF dselc WITH HEADER LINE. "*--- IMPORTANT
    DATA : ft     LIKE     TABLE OF dfies WITH HEADER LINE.
    DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
    PARAMETERS : bukrs LIKE t001-bukrs .
    PARAMETERS : butxt LIKE t001-butxt.
    PARAMETERS : ort01 LIKE t001-ort01.
    PARAMETERS : waers LIKE t001-waers.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR bukrs.
       SELECT * FROM t001 INTO TABLE t001.
    IMPORTANT
       REFRESH dd.
       dd-fldname = 'BUTXT'.
       dd-dyfldname = 'BUTXT'.
       APPEND dd.
       dd-fldname = 'ORT01'.
       dd-dyfldname = 'ORT01'.
       APPEND dd.
       dd-fldname = 'WAERS'.
       dd-dyfldname = 'WAERS'.
       APPEND dd.
    *------- IMPORTANT
       REFRESH ft.
       ft-tabname  = 'T001'.
       ft-fieldname = 'BUTXT'.
       APPEND ft.
       ft-tabname  = 'T001'.
       ft-fieldname = 'WAERS'.
       APPEND ft.
       ft-tabname  = 'T001'.
       ft-fieldname = 'ORT01'.
       APPEND ft.
       CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
         EXPORTING
          ddic_structure  = 'T001'   "*----- IMPORTANT IF STANDARD STRUCT
           retfield        = 'BUKRS'
           dynpprog        = sy-repid
           dynpnr          = sy-dynnr
           dynprofield     = 'BUKRS'
           value_org       = 'S'
         TABLES
           field_tab       = ft "*---- IMPORTANT
           value_tab       = t001
           dynpfld_mapping = dd   "* IMPORTANT
         EXCEPTIONS
           parameter_error = 1
           no_values_found = 2
           OTHERS          = 3.
    regards,
    amit m.

  • I have an ipad 4 running ios 7 but i noticed ios 7 on my ipad seems laggy. I already did a factory reset but it seems doesn't change a bit. Are there any solution for this or I need to wait for the next ios 7 update?

    Am I the only one who facing this problem or there someone else. I did a factory reset yesterday but it still laggy. Do I need to wait for the next ios 7 update or what?

    Hi Amish,
    I should have mentioned that I have signed out of the iCloud Control Panel several times and no syncing occurs.
    Thanks for your response anyway. I appreciate your feedback.

  • Is there a solution for the missing letter in the Arabic keyboard , IPhone 4s Os 5??

    Is there a solution for the missing letter in the Arabic keyboard , IPhone 4s Os 5??

    Please specify the letter you think is missing.  You should be able to find all letters you need by holding down keys which generate popup menus to give you additional options.

  • HT1977 I purchased a game on my ipod touch. I restored the device to factory settings last night and when I synced all the apps back, the game is now in the demo version. How do I unlock it ? I hope I don't need to pay for the full version again.

    I purchased a game on my ipod touch. I restored the device to factory settings last night and when I synced all the apps back, the game is now in the demo version. How do I unlock it ? I hope I don't need to pay for the full version again.

    PES 2012 is no longer available in the US App Store and only on the British App Store currently.
    http://pes-2012.en.softonic.com/iphone
    That (an app no longer available) happens sometimes.
    Your only way is if you have the appt on your computer such as in the recycle bin/trash or in a computer file backup. In that case move it to your iTunes library and sync.

  • My solution for the "Error -50" and/or "Syncing" problem

    Hi
    After upgrading to iPhoto 5.0.2 I also had the "Error: -50" problem"
    How have I solved this problem => also with the help and tips from other forums.
    • Before the upgrade all my pictures from iPhoto were available on my iPod Photo (30 GB)
    • After the upgrade of iPhoto to 5.0.2 I received the "Error: -50" every time I tried to synchronize my iPod. Strange, strange, strange, ...
    => first I detected that putting pictures on my iPod starting from a folder (in stead of iPhoto) worked fine.
    Trying to change back to iPhoto did not work and no albums where available in the iPod Options view!
    => then I tried to create a new iPhoto library (press and hold Option(alt)-key while starting iPhoto), put some pictures and albums in it ... and even this did not work.
    What did I do to solve this problem!
    1. I thrashed my iPhoto application (DO NOT empty you trash, because you have to put it back again)
    2. I used "Disk Utility" to repair the disk permissions.
    3. I put back my iPhoto application from the thrash (same location as before - Applications folder)
    4. and did again a "repair disk permissions"
    5. then I tried to sync my NEW iPhoto library on my iPod and EUREKA this worked.
    6. Then I switched back to my original iPhoto library (launch iPhoto holding the Option key).
    7. Tried to sync ... again the same problem => no pictures and albums available in the iPod - Optoins - Photo tab.
    => conclusion : the problem has to be in my iPhoto library
    8. after trying many things (such as eliminating albums => trail and error method) I found the cause for my problem.
    => I used KEYWORDS in my iPhoto library with strange characters and had SMART albums using it. In my situation it was the "&" character.
    Replacing or removing this character solved my problem. All my pictures and albums were available in the iPod - Options - Photo tab
    9. Sync could be started ... Youpi!
    After synchronizing my iPhoto library I noticed that not all pictures were available on the iPod. I start looking which pictures that were missing on my iPod. When I found them I wanted to know why they were not synchronized.
    I found the explanation in the file "AlbumData.xml" in the "iPhoto Library" folder.
    If you open this file with TextEdit and search for this missing file then you'll find that (at least in my case) corresponding path does not exist (any more). And that was the case for each missing file!
    How solving this problem?
    1. I tried rebuilding the iPhoto Library => launch iPhoto holding the Option and Command keys. This did not work.
    2. What did I do?
    2.1. First I exported all my Pictures from the active iPhoto Library (Share - Export)
    => VERY IMPORTANT NOTE : all extra info such as "Key words", Albums, ... will NOT be saved!
    2.2. I created a new iPhoto Library (launch iPhoto holding the Option key)
    2.3. Then I imported all exported pictures.
    => if you check the file paths in the AlbumData.xml file, you'll see that this info is correct!
    2.4. At least I recreated (manually) all "Key words", Albums, ... so I had a duplicate of my original Library.
    I hope this also works for other people with the same problem.
    Greetings
    P@nt@ni

    Here my solution for the itunes' "unknown error -50" and not showing any albums in the prefs' tab:
    1. All rebuilding options in iphoto didn't resolve the problem.
    2. I opened the file "AlbumData.xml" in the iPhoto-Library-Folder with a text editor. I figured out, that the problem wasn't in the Albums, but in the "Master Image List"-Section. They look like this:
              <key>1741</key>
              <dict>
    .. titles, filenames, ....
    </dict>
    After making a backup of this file, I started deleting entries here (you know, the fastest way to do it is to split it always in halves and check in iTunes if the error still exists). After about half an hour I got the problem key.
    3. The problem was: Some (curious) white spaces at the BEGINNING of the comment! Curious, because they weren't visible in iPhoto's comment, but I could delete them in Iphoto! I guess they weren't normal space characters, but any special symbols (line feeds? whatever)
    4. After that, the -50 error was gone. Now I could see the Album Names. But the sync stopped after a while with a "... file not found...." - error.
    5. Again, with trial&error I found out, that 4 pictures in the last 3 months' rolls made this second problem: I just duplicated them in iPhoto and deleted the original ones. So I still don't know why they have produced this error... anyway,
    6. Now all of my photos sync well.
    .. well, the whole story took me 2 evenings. I really didn't switched to Mac to play debugger for Apple. Do they read these groups here or do I better write them anywhere? They should get those problems fixed asap! As far as I read in the groups, those errors do exist quite a long time?!
    My versions:
    iPhoto 5.0.4 (263)
    iTunes 5.0.1 (4)
    OS X 10.3.9
    iPod Nano 1.0

  • I moved from the UK to the US with my iMac. What do I need to buy for the UK iMac to work in the US? A power convertor? A plug convertor? or Both?

    I moved from the UK to the US with my iMac. What do I need to buy for the UK iMac to work in the US? A power convertor? A plug convertor? or Both?  I had previously read that you only need a plug convertor (three prong to two prong).  But I'm terrified that my iMac will blow up if I only use a plug convertor and not some sort of voltage convertor (Transformer).

    I'm not really hardware tech savy - is it easy to pop out the UK power cable and plug in the US power cable? Or do I need to get someone like an iMac support guy to do this? And because of the voltage difference, is there something built into the iMac that takes care of the voltage difference for me?  Thanks!!

  • I need a reference for the parameters in Firefox about:config.

    I need a reference for the parameters in Firefox about:config.
    I can't find it on the Web.

    *http://kb.mozillazine.org/about%3Aconfig_entries
    *http://kb.mozillazine.org/Category:Preferences
    There is also info in the Firefox preferences files (open via the location bar):
    *resource:///defaults/pref/firefox.js
    * resource:///greprefs.js

  • I'm travelling to the philippines to bring my mac book pro, do i need an adapter for the 220v outlet?

    i'm travelling to the Philippines  to bring my mac book pro, do i need an adapter for the 220 v outlet?

    You will need an adaptor to convert the plug only, the voltage is fine.

  • Is there a solution for the limited time of videorecording?

    Is there a solution for the limited time of videorecording?
    By recording on my iPad2 there is a maximum time of 49 minutes and 51 seconds.

    Hello Studio X
    I have an iPad2 with 64 GB. After I start the videorecording it stops automaticly by 49 minutes en 51 seconds.
    I looked in my settings and there was still enough space left. Although I do not think that the 64Gb is not the problem.
    I bought myself an alternative recording app now. I hope it works properly but if the quality is OK. I do not know. I combine the recordings with my video (digitaltape) camera of Sony.
    Thanks for your reply
    sozave007

  • Has anyone found a solution for the error "The iCloud Control Panel did not install properly".  I'm using windows 7 prof 64 and outlook 2010 and cant get to cloud to winkd ot my mail, contacts, calendar.

    Has anyone found a solution for the error "The iCloud Control Panel did not install properly".  I'm using windows 7 prof 64 and outlook 2010 and cant get to cloud to winkd ot my mail, contacts, calendar.  Cloud control panel version 2.0.

    Has anyone found a solution for the error "The iCloud Control Panel did not install properly".  I'm using windows 7 prof 64 and outlook 2010 and cant get to cloud to winkd ot my mail, contacts, calendar.  Cloud control panel version 2.0.

  • Has anyone come up with a solution for the WD Passport and Mavericks OSX issues yet?

    I was wondering if anyone has come up with a solution for the newer Macbook Pro/Mavericks and external WD Passport not mounting problems?
    I have a couple of year old WD Passport that worked fine in my old 2009 Macbook Pro, the problem is the old computer crashed.
    My dilemna; My new 2014 Mackbook Pro will not open my WD Passport, called WD Support, their answer, sorry, nothing has been solved.
    Is there anyway I can get access to my files on the Passport with any other software, or by using a PC.
    I am aware of reformatting the HD, and have read all the forums I could find and have tried installing the WD Update as well, (with the support tech from WD) and nothing works.
    I know that my WD Passport works, so please don't suggest checking it, or the cord.
    I appreciate all the help anyone can offer, and I am with all the rest of you struggling for solutions.
    Thanks so much

    Hi everyone, this is what I did
    1. upgrade disks to the latest firmware
    2. de-install ntfs-3g and MacFuse.
    3. Re-install NTFS 3G  without Macfuse.
    4. Next step: Install OSXFUSE latest version with selection MacFUSE compatibility layer.
    5. Last step: Install Fuse Wait
    Note: between steps 2 and 5, I restarted my machine.
    It worked for me, after about 4 hours.

Maybe you are looking for

  • In Portal Content admin Role "Portal content" folder is not displaying

    Hi,       I created a user in EP and assign Only Content admin Role. But in portal content area "Portal content "folder is not displaying. Can someone help me the process steps to achieve it? Thanks, kundan

  • 5 Ghz vs 2.4 Ghz

    Howdy I am currently using a Time Capsule as a router. It is located in my office, which is upstairs. My wife uses her Mac laptop in her office, which is down stairs. Her connection to the internet, which is wireless and through the Time Capsule, is

  • Not Syncing to Windows or iTunes?

    please help i dont no y but it wont sync to my computer or to itunes and i want it fixed but i dont no how 2?

  • Can't open documents because of a program error (pop-up)

    Working in Photoshop i want to open other document, when opening a pop-up appears with the message: Can't execute your request because of a program error.* I keep on working with: Go to finder en drag the document in photoshop and go on, but it's not

  • Where are passwords saved on my comp?

    Where exactly are passwords, user names, and other info the Autofil text uses saved on my computer? How do I access them? What can I do to see them and print them out? I would like to Reset Safari in order to remove cookies but I'm told it will also