Transfer Data

i have 1 question
import java.io.*;
import java.net.*;
public class Client {
     public static void main (String args[]) {
          Input in;
          Output out;
          Socket socket;
          try {
               socket = new Socket("localhost", 10000);
               in = new Input (socket.getInputStream());
               out = new Output (socket.getOutputStream());
               int userChoice = 0;
               BufferedReader br = new BufferedReader (new InputStreamReader (System.in));
               BufferedReader rs = new BufferedReader (new InputStreamReader (System.in));
               System.out.println ("Connecting");
               //in.start ();
               //out.start ();
               do {
                    System.out.println ("1 - Add Contact");
                    System.out.println ("2 - View Contact");
                    System.out.println ("3 - Exit");
                    System.out.print ("Option: ");
                    userChoice = Integer.parseInt (br.readLine());
                    if (userChoice == 1) {
                         String strName, strCourse, tmp;
                         try {
                              System.out.print ("Enter name: ");
                              strName = rs.readLine();
                              System.out.print ("Enter course: ");
                              strNumber = rs.readLine ();
                              tmp = "INSERT INTO [YY]([YYname],[YYnumber]) VALUES ('" + strName + "', '" + strNumber + "')";
                              System.out.println(tmp);   // I want Transfer this to my server side code.
                         catch (Exception ex) {
                              System.err.println ("ERROR: " + ex.getMessage());
                    else if (userChoice == 2) {
                    else if (userChoice != 3) {
                         System.out.println ("ERROR: Invalid Choice.");
                    System.out.println ();
               } while (userChoice != 3);
          catch (Exception ex) {
               System.err.println (ex.getMessage());
}above is my client side code
i want the people key the data first
after that sent the tmp to my server side.
import java.io.*;
import java.net.*;
public class Server {
     public static void main (String args[]) {
          Input in;
          Output out;
          Socket socket;
          ServerSocket serverSocket;
          try {
               // setup server socket to listen on port 10000
               serverSocket = new ServerSocket (10000);
               socket = serverSocket.accept ();
               in = new Input (socket.getInputStream());
               out = new Output (socket.getOutputStream());
               in.start ();
               out.start ();
          catch (Exception ex) {
               System.err.println (ex.getMessage());
class Input extends Thread {
     String tmpData;
     BufferedReader br;
     Input (InputStream in) {
          br = new BufferedReader (new InputStreamReader (in));
          tmpData = "";
     public void run () {
          try {
               while ((tmpData = br.readLine ()) != null) {
                    System.out.println ("[REMOTE] " + tmpData);
          catch (Exception ex) {
               System.err.println ("ERROR: " + ex.getMessage ());
     public void close () {
          try {
               br.close ();
          catch (Exception ex) {
               System.err.println ("ERROR: " + ex.getMessage ());
class Output extends Thread {
     String tmpData;
     BufferedReader br;
     PrintStream ps;
     Output (OutputStream out) {
          ps = new PrintStream (out);
          br = new BufferedReader (new InputStreamReader (System.in));
     public void run () {
          try {
               while ((tmpData = br.readLine ()) != null) {
                    ps.println (tmpData);
                    ps.flush ();
                    if (tmpData.equalsIgnoreCase ("exit")) {
                         System.exit (0);
          catch (Exception ex) {
               System.err.println ("ERROR: " + ex.getMessage());
     public void close () {
          try {
               ps.close ();
               br.close ();
          catch (Exception ex) {
               System.err.println ("ERROR: " + ex.getMessage());
}

Problem is i dun know how to using the java.net to transfer it
I trying before
the server side there not response.
else is want me key in 2 time
if you open the client side this 2 thing
//in.start ();
//out.start ();

Similar Messages

  • How can I transfer data from one iPhone to another iPhone which is already set up?

    I have an old phone that I want to transfer data to. The phone is set up with previous data. How do I transfer current data to it?

    if the iphone have not been synced with another computer then just sync it with yours
    if it have then you cant syncing it with your computer would then clear the iphone and adding the info from your itunes to it

  • How can I transfer data from one phone to another

    I have a damaged iPhone 3 and am trying to transfer data to another iPhone 3.  How can I do that?

    take a look at the link   http:///support.apple.com/kb/HT2109

  • How do i transfer data from one internal tabe to another.

    Hi All,
             How do i transfer data from one internal tabe to another.
             Can i do it ebven if he tables are different in structure.
    Please Advice.
    Thanks in advance.

    Hi Saket Tiwari,
    I hope the earlier post by kashyap is good enough an answer. anywas in addition to it let me give a detailed
    explanation of how you can populate an internal table.
    1) Append data line by line.
         Syntax :  APPEND [<wa> TO / INITIAL LINE TO] <itab>.
    this appends new line to internal table <itab>.
    2) Using COLLECT statement.
                 COLLECT is another form of statement used for populating the internal tables.  Generally COLLECT is used while inserting lines into an internal table with unique standard key. The syntax for COLLECT statement is as shown
         Syntax : COLLECT [<wa> INTO] <itab>.
    3) Using INSERT statement
         Syntax  INSERT [<wa> INTO / INITIAL LINE INTO] <itab> [index <idx>].
    INSERT statement adds a line/work area to the internal table. You can specify the position at which the new line is to be added by using the INDEX clause with the INSERT statement.
    Now coming to your request..
    To append part or all of an internal table
         Syntax
                  APPEND LINES OF <itab1> [FROM <n1>] [TO <n2>] TO <itab2>.
    *     Note:
    Without the FROM and TO options, this statement appends the entire table <itab1> to <itab2>.*
    b) To insert part or all of an internal table into another internal table
         Syntax
              INSERT LINES OF <itab1> [FROM <n1>] [TO <n2>]
              INTO <itab2> [INDEX <idx>].
    c) Using Move statement.
    To copy entire contents of one table into another in one execution
         Syntax MOVE  <itab1> To <itab2>.
                   OR
              <itab1> = <itab2>.
    but u hav to be careful because he contents of itab2 will eb overwritten on the execution of this statement.
    These copy the contents of ITAB1 to ITAB2. Incase of internal tables with header line we have to use [] inorder to distinguish from work area. So, to copy contents of internal tables with header line  the syntax becomes,
    ITAB1[] = ITAB2[].
    Coming to the letter part of your question, Yes, we can copy values between tables having different structures.
    for this we use    
                                MOVE-CORRESPONDING <itab1> TO <itab2>
        this executes the statement for their header lines. Searches for the sub-fields which occur both in itab1 and itab2 and then generates, for all relevant field pairs which correspond to the
            sub-fields ni , statements of the form MOVE itab1-ni TO itab2-ni. The other fields remain unchanged.
    I hope the information provided has been of your help.
    Reward if useful.
    Regards,
    Jose

  • How do I transfer data from one exterior harddrive to another?

    How do I transfer data from one exterior harddrive to another when they are both connected to our Imac Desktop?

    Depends what you want to transfer...
    A few more Details about what you are trying to achieve would be good.

  • How to i create a new itunes account for my old iphone so i can transfer data to new iphone, since my daughters new iphone is now linked to my acc and she ends up with all my apps and contacts etc

    My daughter has previously had an ipod which was linked to my itunes iphone account.
    she now has a new iphone and has linked this to that account and now she receives all my contacts apps etc when she syncs her account.
    How do i create a new itunes account for my old iphone so that i can transfer data to my new iphone and keep the two seperate so that when she deletes all my contacts and apps and then syncs her phone again we can still be compatible.

    iOS 5 & iCloud Tips: Sharing an Apple ID With Your Family

  • In Icloud I can't see my "numbers" icon which i need to select "tick" to transfer data to my other devices via icloud. any ideas why it's not showing up?

    In Icloud on my imac I can't see my "numbers" icon which i need to select "tick" to transfer data to my other devices via icloud. any ideas why it's not showing up?

    You have to do it app wise, which means that the icon won't show up in settings, but you will be able to move files from your local drive to iCloud via the Numbers app (move... > choose the iCloud option).
    It requires that you set up the same iCloud account on all your devices and that you have the latest version of Numbers on all your devices as well.

  • Is that possible to transfer data from old apple id to new apple id becoz my old apple id is not working

    Is that possible to transfer data from old apple id to new apple id becoz my old apple id is not working.

    Merging of Apple ID accounts is not possible.

  • Change in Specify Transfer Date/Last Closed Fiscal Year in Asset Accounting

    Hi,
    While uploading the asset master data and values,I have given the Specify Transfer Date/Last Closed Fiscal Year date as 31-12-2008.But as per the fiscal year 4-4-5,2008 closed on 03-01-2009.
    what are the consequences,If we change the Specify Transfer Date/Last Closed Fiscal Year date from 31-12-2008 to 03-01-2009 as the 2008 closed on 03-01-2009.
    Kindly give me some inputs regarding this change.
    Thanks
    Supriya

    Hi
    Please note
    I you change the transfer date to current FY date , system will not allow u to upload data in PY.
    See the below
    Transfer Date
    This date determines the status of posting to be used for the
    transfer (posting up to this date will be included in the transfer), not
    the actual date the data transfer is carried out. This specification
    also determines whether you want to perform the transfer during the
    fiscal year (with transfer of posted transactions/depreciation in the
    current fiscal year) or at the end of the fiscal year (without
    transactions).
    If the transfer date is not the last day of the fiscal year (according
    to the fiscal year variant in FI), the system interprets this as
    transfer during the fiscal year. The system cannot transfer any
    historical transactions. It can only transfer cumulative values from the
    end of the last fiscal year, and the transactions in the current fiscal
    year (the second is only possible for transfer during the fiscal year).
    Example
    transfer date = December 31, 1997
    => last closed fiscal year = 1997
    Specify Last Period Posted in Prv.System (Transf.During FY)
        You must specify the period up to which depreciation was posted in the previous
        system. This period refers to the posted depreciation that is to be
        transferred during old assets data takeover.
    Thanks
    GG

  • Transfer data from one database to another without identities but keep the relation b/w PK and Foreign key

    Hi,
    I need to transfer data from one database to another database (both are identical databases). 
    1. Not transferring identity columns (primary keys). the destination table might have the same key.
    2. keep the PK's and FK's relation b/w parent and child table
    3. I have 4 levels 
    Example: tableA (col1 int identity(1,1) , col2, col3)
    tableB (col1 int identity(1,1) ,
    col2 , col3) -- col2 has the foreign key relation with tableA.col1
    tableC (col1 int identity(1,1) ,
    col2, col3) -- col2  has the foreign key relation with tableB.col1
    tableD (col1 int identity(1,1) , col2, col3) -- col2  has the foreign key relation with tableC.col1
    please advise me.
    Thanks in advance

    Try the below:
    /********************************SAMPLE TARGET***************************************************************/
    Use MSDNSamples
    create table TableA(LevelValueId int identity(1,1) primary key, name varchar(100))
    Insert into TableA(name) Select 'R1'
    Insert into TableA(name) Select 'R2'
    create Table TableB(ChildId int identity(100,1),name varchar(100), LevelValueID int references TableA(LevelValueId))
    Insert into TableB(name,LevelValueID) Select 'Childname1',1
    /********************************SAMPLE TARGET***************************************************************/
    /********************************SAMPLE SOURCE***************************************************************/
    Use Sample
    create table TableA(LevelValueId int identity(1,1) primary key, name varchar(100))
    Insert into TableA(name) Select 'C1'
    Insert into TableA(name) Select 'C2'
    create Table TableB(ChildId int identity(100,1),name varchar(100), LevelValueID int references TableA(LevelValueId))
    Insert into TableB(name,LevelValueID) Select 'Kidname1',1
    /********************************SAMPLE SOURCE***************************************************************/
    USe MSDNSamples
    /********************************MIGRATION INTERMEDIATE TABLE***************************************************************/
    --Migration table
    Create table Mg_TableA(LevelValueId int, NewValueId int)
    /********************************MIGRATION INTERMEDIATE TABLE***************************************************************/
    /********************************ACTUAL MIGRATION FOR MASTER TABLE***************************************************************/
    MERGE INTO TableA
    USING sample.dbo.TableA AS tv
    ON 1 = 0
    WHEN NOT MATCHED THEN
    INSERT(name) Values(tv.name)
    Output tv.levelValueId ,inserted.LevelValueid INTO
    Mg_TableA;
    /********************************ACTUAL MIGRATION FOR MASTER TABLE***************************************************************/
    /********************************ACTUAL MIGRATION FOR CHILD TABLE***************************************************************/
    Insert into TableB (name,LevelValueID)
    Select A.name,B.NewValueId From sample.dbo.TableB A
    Inner join Mg_TableA B on A.LevelValueID = B.LevelValueId
    /********************************ACTUAL MIGRATION FOR CHILD TABLE***************************************************************/
    /********************************TEST THE VALUES***************************************************************/
    Select * From TableA
    Select * From Mg_TableA
    Select * From TableB
    /********************************TEST THE VALUES***************************************************************/
    Drop table TableB,Tablea,Mg_TableA
    Use Sample
    Drop Table TableB,Tablea

  • How to transfer data from legacy system  to SAP

    Hi Friends,
    I would like to know the process and the steps followed to transfer data from my legacy system to SAP.
    Suppose if i have all the data in the form of Excel sheet or doc type. How can i transfer this data into SAP.
    Please explain the steps followed.
    Appreciate your help
    Anil

    Hi ,
    Conversion of legacy data into SAP can be uploaded using a standard SAP Tool called LSMW ( TCode:LSMW).
    the below link gives a brief explanation of the LSMW tool
    http://tutorialsap.com/abap/sap-lsmw-tutorial-with-steps-to-create.html
    There are various methods to upload data within LSMW. If the number of records are very high like Article Master or  Conditions for Retail the IDOC method must be used.
    Standard IDocs
    1. Article Master - ARTMAS
    2. Conditions - COND_A
    3. Source list - SRCLST
    4. Customer Master or WRF3/WRF6 tables - DEBMAS
    5. Vendor master- CREMAS
    Etc. Use transaction code WE60 to see the structure of each of the idocs. New enhancements can be done for the idocs if the required field is not available.
    Regards
    Prabhu

  • How can you transfer data from one ipod to another ?

    How can you transfer data from one ipod to another ipod ?

    The geniusbar told me what to do, I understood but there is still a problem for me >:/ It's not showing up though. Like "device."  Nothing is happening, and I tried as soon as I got home. Then after half an hour, then an hour, then 3 hours. My problem is that it's not showing up! It's stuck in recovery mode! There's still like 25% battery. So I have no idea why.

  • How do I transfer data from one iPhone to another?

    How do I transfer data from one iPhone to another?

    If your old device is an Apple using iOS 5 or later, and you have an iCloud account, you can transfer all your saved messages, email accounts, photos, notes, and other personal settings to your new iPhone.
    Here's how...
    Connect your old Apple device to WiFi and to a power source.
    Back it up to iCloud by going to Settings > iCloud > Storage & Backup and toggling iCloud Backup on. The time it takes to ba ckup depends on how much data you have and on the speed of your internet connection.
    iCloud backs up your device once a day. If it needs backing up before you transfer to your new iPhone 5, tap Back Up Now in Settings > iCloud > Storage & Backup. Do not start transferring before the backup is finished.
    Turn on your new iPhone and complete the setup by selecting your language and country, and choose whether to enable Location Services. When prompted, choose your WiFi network.
    When prompted to set up, choose Restore from iCloud Backup, tap Next, and enter your Apple ID and password.
    Select the backup of your old device and tap Restore. Wait until the device has finished restoring from the backup.
    When the restore process is complete, your iPhone will restart and be ready to use.
    Connect your iPhone 5 to iTunes to sync data not contained in the backup (such as music, videos, apps, and so on). You can choose the data that are synced by clicking the syncing tabs in iTunes.

  • Can i transfer data from one icloud itunes account to another

    my son has used my i cloud to back up his school work and would like to transfer it to his i cloud account so he can use it on his other devices , computer etc
    is this possible?
    I have very little on the i cloud account but do use it for photos etc

    You cannot transfer data from one account to another.

  • Can you transfer data from one iPad to another iPad

    Can you transfer data, books and music from one iPad to another .

    You can use iCloud to sync your books and music bought in the iTunes Store, but for anything that you didn't purchased in iTunes Store you must use iTunes

  • How can i transfer data from old MacBook Pro, which is too old to update time machine, to the newest MacBook Pro?

    I recently bought a new MacBook Pro, and wanted to transfer all the data from my old MacBook Pro, but I get the message saying I need to update time machine on my old one in order to use time machine. However, my old one is too old to update. So I decided to use the cable to transfer, because I heard I can do it that way even though it could take time. But I have no idea what to do...
    Can someone help me?

    A Basic Guide for Migrating to Intel-Macs
    The Knowledgebase article Intel-based Mac: Some migrated applications may need to be updated refers to methods of dealing with migrating from PowerPC chips to Intel with the Migration Assistant safely. The authors of this tip have not had a chance to verify this works in all instances, or that it avoids the 10.6.1 and earlier Guest Account bug that caused account information to get deleted upon use of the Migration/Setup Assistant. However, a well backed up source that includes at least two backups of all the data that are not connected to your machine will help you avoid potential issues, should they arise. In event it does not work, follow the steps below.
    If you are migrating a PowerPC system (G3, G4, or G5) to an Intel-Mac be careful what you migrate.  Keep in mind that some items that may get transferred will not work on Intel machines and may end up causing your computer's operating system to malfunction.
    Rosetta supports "software that runs on the PowerPC G3, G4, or G5 processor that are built for Mac OS X". This excludes the items that are not universal binaries or simply will not work in Rosetta:
    Classic Environment, and subsequently any Mac OS 9 or earlier applications
    Screensavers written for the PowerPC System Preference add-ons
    All Unsanity Haxies Browser and other plug-ins
    Contextual Menu Items
    Applications which specifically require the PowerPC G5 Kernel extensions
    Java applications with JNI (PowerPC) libraries
    See also What Can Be Translated by Rosetta.
    In addition to the above you could also have problems with migrated cache files and/or cache files containing code that is incompatible.
    If you migrate a user folder that contains any of these items, you may find that your Intel-Mac is malfunctioning. It would be wise to take care when migrating your systems from a PowerPC platform to an Intel-Mac platform to assure that you do not migrate these incompatible items.
    If you have problems with applications not working, then completely uninstall said application and reinstall it from scratch. Take great care with Java applications and Java-based Peer-to-Peer applications. Many Java apps will not work on Intel-Macs as they are currently compiled. As of this time Limewire, Cabos, and Acquisition are available as universal binaries. Do not install browser plug-ins such as Flash or Shockwave from downloaded installers unless they are universal binaries. The version of OS X installed on your Intel-Mac comes with special compatible versions of Flash and Shockwave plug-ins for use with your browser.
    The same problem will exist for any hardware drivers such as mouse software unless the drivers have been compiled as universal binaries. For third-party mice the current choices are USB Overdrive or SteerMouse. Contact the developer or manufacturer of your third-party mouse software to find out when a universal binary version will be available.
    Also be careful with some backup utilities and third-party disk repair utilities. Disk Warrior, TechTool Pro , SuperDuper , and Drive Genius  work properly on Intel-Macs with Leopard.  The same caution may apply to the many "maintenance" utilities that have not yet been converted to universal binaries.  Leopard Cache Cleaner, Onyx, TinkerTool System, and Cocktail are now compatible with Leopard.
    Before migrating or installing software on your Intel-Mac check MacFixit's Rosetta Compatibility Index.
    Additional links that will be helpful to new Intel-Mac users:
    Intel In Macs
    Apple Guide to Universal Applications
    MacInTouch List of Compatible Universal Binaries
    MacInTouch List of Rosetta Compatible Applications
    MacUpdate List of Intel-Compatible Software
    Transferring data with Setup Assistant - Migration Assistant FAQ
    OS X Lion: How to use Migration Assistant to transfer files from another Mac
    Because Migration Assistant isn't the ideal way to migrate from PowerPC to Intel Macs, using Target Disk Mode, copying the critical contents to CD and DVD, an external hard drive, or networking will work better when moving from PowerPC to Intel Macs.  The initial section below discusses Target Disk Mode.  It is then followed by a section which discusses networking with Macs that lack Firewire.
    If both computers support the use of Firewire then you can use the following instructions:
    Repair the hard drive and permissions using Disk Utility.
    Backup your data.  This is vitally important in case you make a mistake or there's some other problem.
    Connect a Firewire cable between your old Mac and your new Intel Mac.
    Startup your old Mac in Transferring files between two computers using FireWire.
    Startup your new Mac for the first time, go through the setup and registration screens, but do NOT migrate data over. Get to your desktop on the new Mac without migrating any new data over.
    If you are not able to use a Firewire connection (for example you have a Late 2008 MacBook that only supports USB:)
    1. Set up a local home network: Creating a small Ethernet Network.
    2. If you have a MacBook Air or Late 2008 MacBook see the following:
    MacBook (13-inch, Aluminum, Late 2008) and MacBook Pro (15-inch, Late 2008)- What to do if migration is unsuccessful;
    MacBook Air- Migration Tips and Tricks;
    MacBook Air- Remote Disc, Migration, or Remote Install Mac OS X and wireless 802.11n networks.
    Copy the following items from your old Mac to the new Mac:
    In your /Home/ folder: Documents, Movies, Music, Pictures, and Sites folders.
    In your /Home/Library/ folder:
    /Home/Library/Application Support/AddressBook (copy the whole folder) /Home/Library/Application Support/iCal (copy the whole folder)
    Also in /Home/Library/Application Support (copy whatever else you need including folders for any third-party applications)
    /Home/Library/Keychains (copy the whole folder) /Home/Library/Mail (copy the whole folder) /Home/Library/Preferences/ (copy the whole folder) /Home /Library/Calendars (copy the whole folder) /Home /Library/iTunes (copy the whole folder) /Home /Library/Safari (copy the whole folder)
    If you want cookies:
    /Home/Library/Cookies/Cookies.plist /Home/Library/Application Support/WebFoundation/HTTPCookies.plist
    For Entourage users:
    Entourage is in /Home/Documents/Microsoft User Data Also in /Home/Library/Preferences/Microsoft.
    Credit goes to Macjack for this information.
    If you need to transfer data for other applications please ask the vendor or ask in the  Discussions where specific applications store their data.
    5. Once you have transferred what you need restart the new Mac and test to make sure the contents are there for each of the applications.
    Written by Kappy with additional contributions from a brody.Revised 5/21/2011

Maybe you are looking for

  • Tab Content Height

    I have a spry tabbed panel on my site with four tabs. The first tab has a little content, the second tab has a little more, the third panel has a little content and the fourth panel has a LOT of content. The problem is that when you are on tab 1 by d

  • Can You Set-up a Sub mail Address Folder?

    I'm switching from Microsoft Outlook Mail to the Apple address and I wondering if there is a way to set-up a sub address folders like I can do in Outlook. See example? Business - Services for My Business - My customers - Personnel services - Etc. Any

  • Can itunes remember a podcast's password?

    I remember that iTunes used to have a feature that would remember a password for password-protected podcasts. This feature hasn't worked for a while now, and I was wondering if there was a workaround. It just gets annoying having to type this stuff o

  • EA 2700 disconnecting every once in awhile. (30/60minutes)

    Heya, I'm having issues with a newly bought EA 2700 router, I'm getting disconnected every 30-60 minutes. (It's a brief disconnect for about 10seconds, perhaps a huge packet loss or something?) I've tried connecting directly to the modem and that see

  • What is the best way to exit an application?

    Hi In many examples I have seen an eventlistener used to exit an applicaiton when the user closes the window. However I recently came across the method: setDefaultCloseOperation(EXIT_ON_CLOSE) Is this a better way to close an application? What are th