1. Check out our companion app, Forums for Android! Download from Google Play

Data transfer problem in application

Discussion in 'Application Development' started by AndDevloper, May 4, 2010.

  1. AndDevloper

    AndDevloper New Member
    Thread Starter
    5

    Apr 20, 2010
    3
    0
    5
    Hi Everybody,
    I started learning android just a couple of weeks ago, so I am very new to it. I required some help regarding this application that I want to build.
    My application is one that requires a data transfer between a client and a server. The client is running on android and the client sends some data at a very frequent rate to the remote server, which then compiles/understands the data so obtained. How can this be implemented very efficiently in android. What kind of classes/resources will be required?

    My second question is that does Android have the capability to run on a tablet as of now? If so, how will that happen? Could you please explain a little?

    I'll be really grateful if someone could help me out here. I am finding this a little tough and could do with some help here.
    Thanks in advance.
     

    Advertisement

  2. fabiocberg

    fabiocberg Active Member
    16

    Apr 7, 2010
    27
    1
    16
    Programmer (Coordinator)
    Brazil
    I've already done a client/server where the client was running on android.
    To connect and send data to the server I used the this code:

    Socket socket = new Socket();
    SocketAddress addr = new InetSocketAddress("200.185.55.52", 9000);
    socket.connect(addr);
    OutputStream os = socket.getOutputStream();
    DataOutputStream dos = new DataOutputStream(os);

    You can use 'dos' to write all data that you want to.
    Don't forget to close the streams and the socket when you finish to write the data by calling dos.close() and socket.close().
     
    AndDevloper likes this.
  3. AndDevloper

    AndDevloper New Member
    Thread Starter
    5

    Apr 20, 2010
    3
    0
    5
    Thanks Fabio,
    That helped a lot. My other question was can we run android on a tablet as of now? I mean can we load the whole OS on a tablet using some mechanism?
     
  4. fabiocberg

    fabiocberg Active Member
    16

    Apr 7, 2010
    27
    1
    16
    Programmer (Coordinator)
    Brazil
  5. fabiocberg

    fabiocberg Active Member
    16

    Apr 7, 2010
    27
    1
    16
    Programmer (Coordinator)
    Brazil

Share This Page

Loading...