[英]how can i send file data from android to python?
I want to send file of data from my android In other word { i want to Enter some data like name gender location age ....etc and this in android then take this data and send it to python } can this be file sending ?? 我想从我的android发送数据文件,换句话说{我想输入一些数据,例如姓名,性别,年龄,年龄.... etc,然后在android中输入,然后将其发送到python}这可以是文件发送吗? ? or it must be data ?!!
还是必须是数据?!
尝试使用Android脚本 ,您可以在Android上创建脚本层。
if it is an open sever socket then on the Android just use a client socket and send your data through. 如果是开放式服务器套接字,则在Android上只需使用客户端套接字并通过发送数据即可。 You'll have to decide what the format of the data is and how you will parse it but the commutation part is strait forward.
您必须决定数据的格式是什么以及如何解析它,但是换向部分是向前的。
// Create a socket without a timeout
try {
InetAddress addr = InetAddress.getByName("java.sun.com");
int port = 80;
// This constructor will block until the connection succeeds
Socket socket = new Socket(addr, port);
} catch (UnknownHostException e) {
} catch (IOException e) {
}
// Create a socket with a timeout
try {
InetAddress addr = InetAddress.getByName("java.sun.com");
int port = 80;
SocketAddress sockaddr = new InetSocketAddress(addr, port);
// Create an unbound socket
Socket sock = new Socket();
// This method will block no more than timeoutMs.
// If the timeout occurs, SocketTimeoutException is thrown.
int timeoutMs = 2000; // 2 seconds
sock.connect(sockaddr, timeoutMs);
} catch (UnknownHostException e) {
} catch (SocketTimeoutException e) {
} catch (IOException e) {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.