⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 Bluetooth echo between pc server and client
💻 TXT
字号:

Chapter B1. An Echoing Client/Server Application Using Bluetooth

From:
  Killer Game Programming in Java 

  Dr. Andrew Davison
  Dept. of Computer Engineering
  Prince of Songkla University
  Hat Yai, Songkhla 90112, Thailand
  E-mail: ad@fivedots.coe.psu.ac.th

  Web Site for the book: http://fivedots.coe.psu.ac.th/~ad/jg


If you use this code, please mention my name, and include a link
to the book's Web site.

**NOTE**: this example is NOT in the hardcopy book printed by O'Reilly.

Thanks,
  Andrew


============================

This example is a client/server application using the
Bluetooth API in JSR 82, which is available in version 2.2. 
of the J2ME Wireless Toolkit (WTK22). It can be downloaded from 
http://java.sun.com/products/j2mewtoolkit/

Since it's a client/server example, there are two MIDlets --
the server code is in the EchoServerMIDlet\ directory,
the client code in EchoClientMIDlet\.

============================

The Server-side (in EchoServerMIDlet\)

The Echo Server MIDlet consists of 5 Java files:
   EchoServerMIDlet.java, ScrollableMessagesBox.java, 
   KeyRepeatTask.java, EchoServer.java, 
   ThreadedEchoHandler.java

------
Server Compilation and Execution (using WTK22's KToolbar)

Create a new project called EchoServerMIDlet, with the MIDlet
class name EchoServerMIDlet.

Make sure to select the "Bluetooth/OBEX for J2ME (JSR 82)" API
in the project's API settings.

Copy the Java files to WTK22\apps\EchoServerMIDlet\src\ 

Build and run (but see "Server Notes" below)

------

Server Notes

Since many clients will be connected to the server, it may be necessary
to increase the Bluetooth "bluetooth.connected.devices.max" setting
which specifies the maximum number of connections to a device.

WTK22's value for "bluetooth.connected.devices.max" 
can be set in the "System Properties" tab of the "Bluetooth/OBEX" tab 
in the "Preferences" menu. Increase it to 3 to allow a maximum of
three clients to be connected to the server at once.


============================

The Client-side (in EchoClientMIDlet\)

The Echo Client MIDlet consists of 5 Java files:
   EchoClientMIDlet.java, ServiceFinder.java, ServicesList.java, 
   ClientForm.java, EchoClient.java

------
Client Compilation and Execution (using WTK22's KToolbar)

Create a new project called EchoClientMIDlet, with the MIDlet
class name EchoClientMIDlet.

Make sure to select the "Bluetooth/OBEX for J2ME (JSR 82)" API
in the project's API settings.

Copy the Java files to WTK22\apps\EchoClientMIDlet\src\ 

Build and run (but see "Client Notes" below)

------

Client Notes

Start the server before starting any clients.

Client MIDlets should be run in a separate invocation of 
WTK22 from the server MIDlet. 

I've only been able to start a maximum of two clients before 
socket, security, or JSR 82 initialization errors occur. 

When a problem appears, the WTK22 invocations for the 
client _and_ server need to be restarted.

---------
Last updated: 2nd September 2005

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -