我想通过TCP套接字连接在byte []中发送/接收sqlite数据库文件(* .db)?
答案 0 :(得分:1)
这是:
Socket socket = new Socket(host, port);
FileInputStream fis = new FileInputStream(yourFile);
OutputStream out = socket.getOutputStream();
byte[] buffer = new byte[9182];
int nBytesRead = 0;
while ((nBytesRead = fis.read(buffer) != -1)
{
out.write(buffer, 0, nBytesRead);
}
out.flush();
out.close();
fis.close();