J2ME中文教程 7 开发无线网络应用程序[47]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

            si.setText("Connected to server");

            sender = new Sender(dc);

            while (true)

            {

                Datagram dg = dc.newDatagram(100);

                dc.receive(dg);

                // Have we actually received something or is this just a timeout

                // ?

                if (dg.getLength() > 0)

                {

                    si.setText("Message received - "

                            + new String(dg.getData(), 0, dg.getLength()));

                }

            }

        } catch (ConnectionNotFoundException cnfe)

        {

            Alert a = new Alert("Client", "Please run Server MIDlet first",

                    null, AlertType.ERROR);

            a.setTimeout(Alert.FOREVER);

            display.setCurrent(a);

        } catch (IOException ioe)

本文关键:J2ME中文教程 7 开发无线网络应用程序
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top