To do that you would need to write two separate pieces of software:
1) A Server
2) A Client
I would suggest you install the server on the PC and the client on the phone.
The client would establish a TCP connection to the server and would be able to send messages reliably. Upon receiving the messages from the client (phone) your server (pc) will act accordingly.
You can refer to the java documentation to find two simple samples about creating TCP servers and clients and these should be very helpful. Example Link
发布评论
评论(2)
为此,您需要编写两个单独的软件:
1)服务器
2)客户端
我建议您在PC上安装服务器,在手机上安装客户端。
客户端将与服务器建立 TCP 连接,并且能够可靠地发送消息。收到来自客户端(电话)的消息后,您的服务器(PC)将采取相应的行动。
您可以参考java文档找到两个关于创建TCP服务器和客户端的简单示例,这些应该非常有帮助。 示例链接
To do that you would need to write two separate pieces of software:
1) A Server
2) A Client
I would suggest you install the server on the PC and the client on the phone.
The client would establish a TCP connection to the server and would be able to send messages reliably. Upon receiving the messages from the client (phone) your server (pc) will act accordingly.
You can refer to the java documentation to find two simple samples about creating TCP servers and clients and these should be very helpful. Example Link
你可以使用手机的蓝牙,并用java为你的电脑开发一个服务器。
我已经完成了这个过程。
You can use the bluetooth of the mobile, and develop a Server in java for your pc.
I have done this process.