Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to transfer sqlite3 database between two Android devices using Socket?
    primarykey
    data
    text
    <p>I have read this <a href="https://stackoverflow.com/questions/4837463/transfer-data-between-android-devices">Bluetooth Chat</a> post, and this <a href="https://stackoverflow.com/questions/7650690/transfer-a-file-between-android-devices">Transfer file</a> post.And I have two real android devices ,not AVDs, my intent is to set IP address and port in one device which acts as a Client while the other acts as a Server.</p> <p>They are using WIFI,and I have connected both of them to PC respectively.Get into adb shell ,and ping each other.It works. I have written client code like this:</p> <pre><code> Socket socket = new Socket("192.168.1.142",8888); InputStream in = socket.getInputStream(); byte[] buffer = new byte[in.available()]; Toast.makeText(this, String.valueOf(in.available()), Toast.LENGTH_LONG).show(); in.read(buffer); String msg = new String(buffer); Toast.makeText(this, msg, Toast.LENGTH_LONG).show(); </code></pre> <p>and the Server:</p> <pre><code>ServerSocket server = new ServerSocket(8888); while(true) { Socket client = server.accept(); OutputStream out = client.getOutputStream(); String msg = "Hello Android!"; out.write(msg.getBytes()); client.close(); } </code></pre> <p>I have add this </p> <p><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;</code> to manifest.</p> <p>But no response. I have two questions:</p> <p>1.Why there is no response in my client?</p> <p>2.How to handle with sqlite3 database ,there must be something different with ordinary text files,but what is the difference?</p> <p>Any suggestions will be very appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload