讓變化成為計(jì)劃的一部分

          歡迎大家探討本Blog涉及的所有軟件課題。我的Google Talk ID:zhengyun(at)gmail.com。

          我最希望軟件帶給用戶(hù)的感受是:美好的體驗(yàn)、舒適感、簡(jiǎn)約、干凈...

          posts - 32, comments - 8, trackbacks - 0, articles - 0
            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          我的7610一直好好的,直到昨天突然變成了走CMNET連接點(diǎn)竟然報(bào)告"SymbianOsError -3606"。搞得我想測(cè)試手機(jī)動(dòng)態(tài)IP之間能否直接用Socket通信都測(cè)試不了了。
          查詢(xún)了這個(gè)錯(cuò)誤號(hào),指的是“KErrGenConnDatabaseDefaultUndefined -3606  "No Internet accounts have been set up. Set up an account in Control panel." ”

          后來(lái),終于試出來(lái)了,只要到接入點(diǎn)刪除拔號(hào)連接互聯(lián)網(wǎng),就可以了。然后起應(yīng)用程序,再連接網(wǎng)絡(luò)時(shí),就能夠提示選擇接入點(diǎn)了。而之前出現(xiàn)-3606錯(cuò)誤的時(shí)候,是不會(huì)提示接入點(diǎn)選擇的。

          可能之前我曾經(jīng)用撥號(hào)互聯(lián)網(wǎng)這個(gè)接入點(diǎn)撥號(hào)了,導(dǎo)致手機(jī)以后連CMNET默認(rèn)用這個(gè)接入點(diǎn),不帶提示的。


          posted @ 2005-11-16 15:42 讓變化成為計(jì)劃的一部分 閱讀(235) | 評(píng)論 (0)編輯 收藏

          下面的表格給出了jsr120規(guī)定的受限SMS Port Numbers

          Port number Description
          2805 WAP WTA secure connection-less session service
          2923 WAP WTA secure session service
          2948 WAP Push connectionless session service (client side)
          2949 WAP Push secure connectionless session service (client side)
          5502 Service Card reader
          5503 Internet access configuration reader
          5508 Dynamic Menu Control Protocol
          5511 Message Access Protocol
          5512 Simple Email Notification
          9200 WAP connectionless session service
          9201 WAP session service
          9202 WAP secure connectionless session service
          9203 WAP secure session service
          9207 WAP vCal Secure
          49996 SyncML OTA configuration
          49999 WAP OTA configuration

          普通SMS的端口是特定的,可以通過(guò)this.getAppProperty("SMS_Port")來(lái)獲取,只要你的設(shè)備支持JSR120。

          posted @ 2005-11-16 15:38 讓變化成為計(jì)劃的一部分 閱讀(827) | 評(píng)論 (0)編輯 收藏

          [JavaME]手機(jī)是否能夠申請(qǐng)到動(dòng)態(tài)IP?

          ServerSocketConnection

          http://www.j2medev.com/bbs/dispbbs.asp?boardid=21&id=4099&star=1#2083 ,這里是原始討論貼。

           

          這里我們給出一個(gè)思路:可以先這樣,手機(jī)先訪(fǎng)問(wèn)一個(gè)固定的網(wǎng)址,然后就會(huì)被分配一個(gè)IP,這就是手機(jī)用來(lái)和外界聯(lián)系的IP了。

          Efei說(shuō),剛才測(cè)試了下,使用一段文檔上提供的代碼,也就那兩三句話(huà)

          try{
                ServerSocketConnection scs = (ServerSocketConnection) Connector.open("socket://:1234");
                frmMain.append("ip:" + scs.getLocalAddress());
              }
              catch (Exception e) {}

          取得了一個(gè)IP10.66.7.28

          這個(gè)IP外部網(wǎng)絡(luò)是無(wú)法訪(fǎng)問(wèn)的,換言之,內(nèi)部網(wǎng)絡(luò)可以訪(fǎng)問(wèn)。

          所以只要在移動(dòng)的機(jī)房有服務(wù)器,你可以訪(fǎng)問(wèn)了

          但是還有個(gè)問(wèn)題,這個(gè)IP是動(dòng)態(tài)變化的,所以至少需要客戶(hù)端先訪(fǎng)問(wèn)服務(wù)器一下,讓服務(wù)器知道你現(xiàn)在的IP

          確實(shí)如efei所說(shuō),我在手機(jī)上測(cè)試結(jié)果也是拿到了socket://10.15.134.128:4234,看來(lái)是沒(méi)辦法訪(fǎng)問(wèn)的了。但是我覺(jué)得雖然我們的位于Internet的服務(wù)器無(wú)法訪(fǎng)問(wèn),但是也許另一部手機(jī)是可以訪(fǎng)問(wèn)這個(gè)地址的,所以手機(jī)的p2p理論上也許是可行的。

          我的測(cè)試代碼在http://www.cnblogs.com/Files/zhengyun_ustc/GetDynamicIP.rar下載,安裝的jar包在http://www.cnblogs.com/Files/zhengyun_ustc/GetDynamicIP-deployed.rar下載,

          Nokia7610測(cè)試通過(guò)。

          朋友們也可以自己在真機(jī)上試驗(yàn)下這個(gè)程序。

          用下面的代碼可以得到一個(gè)socket 動(dòng)態(tài)IP

           

          //Use an unrestricted filter.

          String filter = "*";

          String url = "socket://:" + m_sSocketPort;

          ServerSocketConnection ssc = null;

           

          try

          {

               //Open the connection.

               ssc =

                  (ServerSocketConnection) Connector.open(url);

               System.out.println("/* Already Open the connection!");

                 

                //Discover the system-assigned port.

               url = "socket://:" + ssc.getLocalPort();

                //Register the connection now. The AMS will

                //remember the registered URL even when the MIDlet

                //is not active.

               PushRegistry.registerConnection(url,

                       m_sMidletClassName, filter);

               System.out.println("/* Already Register the connection now!" +

                       url);

                //Now publish the push URL. We can use an HTTP

                //POST or a socket or datagram for this.

               String purl;

               purl = "socket://" + ssc.getLocalAddress() +

                  ":" + ssc.getLocalPort();

               publishInboundConnection(purl, m_sMidletClassName);

          }

           

           

           

          posted @ 2005-11-09 00:27 讓變化成為計(jì)劃的一部分 閱讀(380) | 評(píng)論 (0)編輯 收藏

               摘要: This article will recount my experiences on a recent project that involved use of the Wireless Messaging API (WMA) and the Push Registry. The Push Registry is a feature new to the MIDP 2.0 spec, and the WMA, while not a MIDP 2.0 feature, is an optional feature that can be found on several MIDP 1.0 and 2.0 phones.
          http://www.microjava.com/articles/techtalk/WMA20  閱讀全文

          posted @ 2005-11-08 17:37 讓變化成為計(jì)劃的一部分 閱讀(967) | 評(píng)論 (0)編輯 收藏

          MIDlet jar signing (a tutorial)

          http://www.spindriftpages.net/pebble/dave/2005/06/20/1119275880301.html

          I needed to sign a MIDlet and deploy it on a Nokia Series 60 phone (i.e. 6630, 6680 etc) so the user doesn't constantly get security alerts. I figured (hoped?) this might be a fairly simple task since any useful application is likely to need access to restricted functionality. It turns out I was very, very wrong. There is virtually no information on how to sign and deploy an application on the web. Anyway here are the steps I took to get to et my MIDlet signed and installed!

          Get required software

          1. Get and install the Java SDK (JDK) from Sun (you should already have this)

          2. Get and install the Java Wireless Toolkit (WTK) also from Sun

          3. Optionally get and install Ant and Antenna to allow you to automate your build

          Create and import a certificate

          1. You need to use keytool (from the JDK)

          2. I used the following command keytool -genkey -alias {myalias} -keyalg RSA -validity 365

          3. This will prompt you for a keystore password, enter your keystore password (if you have an existing keystore) or the one you want to use if you don't have one yet

          4. Fill in all the prompts about location/company name etc

          5. Run keytool -list to see your new certificate

          6. Next you must export the certificate so you can import it to your phone

          7. Run keytool -export -alias {myalias} -file mycertificate.crt

          8. Import the certificate into your phone, in Windows XP SP2 I could do this by right clicking the file and selecting "Send to Bluetooth Device"

          Build and package the application

          1. Use javac to build your MIDlet paying special attention to your classpath and bootclasspath options (otherwise preverification will fail). I also set target to 1.1 and source to 1.3

          2. Generate your JAD file the critical attributes in the JAD are MIDlet-Jar-URL, MIDlet-Jar-Size, MIDlet-Permissions we also included MIDlet-Icon, MicroEdition-Configuration, MicroEdition-Profile, MIDlet-Name, MIDlet-Push-1, MIDlet-Icon, MIDlet-Descriptionn and MIDlet-Version

          3. Generate the MANIFEST.MF file based on your JAD, you must remove MIDlet-Jar-Size and MIDlet-Jar-URL

          4. Both these tasks can be completed using the wtkJad Antenna task

          5. Package and preverify the app using the wtkPackage Antenna Task you must set the classpath and bootclasspath properties correctly otherwise Preverification will fail

          Sign the application

          1. Sign the Application using jarsigner

          2. Run jarsigner -keystore {mykeystore} -storepass (mypassword} {myjar} {myalias}

          3. Now you have a signed jar you need to update the MIDlet-Jar-Size in your JAD

          4. Now add the certificate to the JAD using JadTool.jar from the WTK

          5. Run java -jar JadTool.jar -addcert -alias {myalias} -storepass {mypassword} -keystore {mykeystore} -inputjad {myinputjad} -outputjad {myoutputjad}

          6. Now add the signature to the JAD again using JadTool.jar

          7. Run java -jar JadTool.jar -addjarsig -alias {myalias} -jarfile {myjar} -storepass {mypassword} -keypass {mypassword} -keystore {mykeystore} -inputjad {myinputjad} -outputjad {myoutputjad}

          8. You can now deploy this to a webserver with the MIME types set correctly and download it to your phone and it will be a trusted 3rd party application

          Tags : jar, signing, nokia, midlets, technology

          posted @ 2005-11-08 17:16 讓變化成為計(jì)劃的一部分 閱讀(298) | 評(píng)論 (0)編輯 收藏

          第一,同一個(gè)端口是不允許兩個(gè)程序監(jiān)聽(tīng)的。
          參見(jiàn)注釋?zhuān)?BR>Trying to bind to an already reserved local address causes an IOException to be thrown!
          也就是說(shuō)。調(diào)用(MessageConnection)Connector.open("sms://:5000"); 時(shí)就會(huì)拋出異常。

          第二,(MessageConnection)Connector.open監(jiān)聽(tīng)不同端口是沒(méi)有問(wèn)題的。比如http://www.cnblogs.com/Files/zhengyun_ustc/SimplePushRegistry.rar的例子,你就可以看出這一點(diǎn)。在midlet的startApp中,
           protected void startApp() throws MIDletStateChangeException {
            
            if (!init) {
                init = true;
                String[] conns =
                  PushRegistry.listConnections(false);
                System.out.println("Found " + conns.length +
                  " connections.");
                for(int ccnt=0; ccnt < conns.length; ccnt++){
                  DatagramHandler handler =
                    new DatagramHandler(conns [ccnt], this);
                  connectionHandlers.addElement(handler);
                handler.start();
                }
              }

           }
          從而得到所有注冊(cè)的連接,并轉(zhuǎn)發(fā)給線(xiàn)程處理。線(xiàn)程就可以根據(jù)所傳入的連接名稱(chēng),自行打開(kāi):
             public DatagramHandler(String c, PushSMSListner midlet){
               try {
                 dgc = (DatagramConnection)Connector.open(c);
               } catch (IOException x){
                   x.printStackTrace();
               }
            
            m_midlet = midlet;
             }

          posted @ 2005-11-08 14:08 讓變化成為計(jì)劃的一部分 閱讀(646) | 評(píng)論 (1)編輯 收藏

               摘要: 一般性的答案是:可以的。只不過(guò)現(xiàn)在的手機(jī)尚且不支持此標(biāo)準(zhǔn)。

          更多的信息:

          對(duì)于JavaCard這種東西,MIDP2.0中擴(kuò)展了一個(gè)叫做Security and Trust Services API for J2ME (SATSA); JSR 177的東西,具體信息參見(jiàn)http://java.sun.com/products/satsa/。  閱讀全文

          posted @ 2005-11-08 13:58 讓變化成為計(jì)劃的一部分 閱讀(892) | 評(píng)論 (0)編輯 收藏

          Question:
          Can I access native functionality from a MIDlet?


          Answer:
          Not directly since MIDP does not support JNI.

            However, it is possible for a MIDlet to communicate with a C++ application running on the host device using a standard communication protocol such as TCP/IP sockets.

            For instance the native application can provide a (server) socket listening for incoming connections on a specific port (say 1234). The MIDlet can then use the GCF to opens a client socket connection using the local loopback address to communicate with the native application as follows:

            SocketConnection mySocket = (SocketConnection) Connector.open("socket://127.0.0.1:1234");

            Once a two way connection has been established the MIDlet client can make requests for data from the native server using a custom protocol understood by both.

            Of course this approach relinquishes many of the tradition strengths of MIDP (such as cross platform portability) requiring as it does the implementation, installation and launching of a dedicated native application as well as the MIDlet. However it may provide a route for application developers to leverage existing Java code to a Java implementation with different capabilities, rather than undertake a complete re-write in C++.

            For further information see:

            Also see FAQ-1206

          posted @ 2005-11-05 17:37 讓變化成為計(jì)劃的一部分 閱讀(417) | 評(píng)論 (0)編輯 收藏

               摘要: 本文檔并不是一個(gè)關(guān)于PopupWinks On Mobile 之Kjava版本的開(kāi)發(fā)說(shuō)明,這里只是一個(gè)總?cè)肟凇N覍⒔o出手機(jī)傳情動(dòng)漫的奇異特性、用戶(hù)使用說(shuō)明,以及演示程序下載地址;并且給出開(kāi)發(fā)指導(dǎo)的相關(guān)鏈接。慢慢看下去,你會(huì)大有收獲的。
          有源代碼可以下載研究。  閱讀全文

          posted @ 2005-11-04 17:32 讓變化成為計(jì)劃的一部分 閱讀(1112) | 評(píng)論 (0)編輯 收藏

          他們真是太棒了!
          montagerv1.0
          http://www.deviousgelatin.com/montager/image.php
          Flickr Montager was created by Billy Fowks | It makes use of the Flickr API

          Mappr

          Mappr, by Stamen Design

          1001

          1001 by Adriaan Tijsseling

          Panoramio

          posted @ 2005-11-01 11:45 讓變化成為計(jì)劃的一部分 閱讀(620) | 評(píng)論 (0)編輯 收藏

          僅列出標(biāo)題
          共4頁(yè): 上一頁(yè) 1 2 3 4 下一頁(yè) 
          主站蜘蛛池模板: 灵璧县| 宁武县| 宜川县| 农安县| 临邑县| 西平县| 汉中市| 彰武县| 资溪县| 宣武区| 武夷山市| 昌平区| 读书| 万全县| 鲜城| 泰兴市| 伊金霍洛旗| 井冈山市| 尉氏县| 霍山县| 阳曲县| 秦安县| 冷水江市| 金乡县| 阿尔山市| 宣化县| 石渠县| 龙井市| 伊金霍洛旗| 周宁县| 江口县| 望奎县| 米易县| 包头市| 鹿邑县| 彭阳县| 邮箱| 巴彦淖尔市| 九龙城区| 杭锦旗| 鄂托克前旗|