如何在J2ME Midlet和PC之间进行通信? [英] How to Communicating between a J2ME Midlet and PC?

查看:77
本文介绍了如何在J2ME Midlet和PC之间进行通信?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过连接的电缆使J2ME Midlet与PC上的Java程序或某些应用程序通信?

How do I make a J2ME Midlet to communicate with a java program or some application on the pc through the cable connected?

推荐答案

Incredible_Honk几乎正确.关键是使用(标准)系统属性"microedition.commports".这提供了以逗号分隔的COM端口列表,这些端口可用于您的应用程序.要打开连接,请按以下步骤使用CommConnection:

Incredible_Honk is almost right. The key is to use the (standard) system property "microedition.commports". This provides a comma delimited list of the com ports which are available to your application. To open a connection use CommConnection as follows:

CommConnection con = (CommConnection) Connector.open("com:<commport name>");

通常,这将提供对USB串行连接的访问​​,如果可能的话,也可以通过红外线进行访问.遍历每个对象,以查看与您要查找的连接相对应的对象.

Usually this will provide access to a USB serial connection, possibly also infrared if available. Iterate through each one to see which one corresponds to the connection you're looking for.

至少在Windows上,您需要首先为手机安装正确的驱动程序.然后,这将允许您打开串行连接并与应用程序通信.

On Windows at least, you will need to install the correct drivers for your handset first. This will then allow you to open a serial connection and communicate with the application.

这篇关于如何在J2ME Midlet和PC之间进行通信?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆