Technical information
Chapter 5: JAVA API
July 15, 2008 G24 KJAVA User’s Guide 5-17
Standard Classes Deviations
Comm Connections
Package: javax.microedition.io.CommConnection.
Description: Handling serial connection.
Three parallel serial ports are available: UART1, UART2 and USB.
See Table 5-5 for Port to Serial mapping.
Server Socket Connection
Package: javax.microedition.io.ServerSocketConnection.
Description: Handling listen TCP/UDP socket.
Deviations:
1. One client per connection socket (up to 9 sockets).
2. More than one ServerSocketConnection instance may listen on the same port.
Example for handling server socket connection
:
public class TcpConnection extends Thread {
public SocketConnection sc = null;
public ServerSocketConnection scn = null;
public InputStream is = null;
public void run() {
//gets port number from jad file
openConnection(getAppProperty("PORT"));
byte[] ReceiveData = new byte[256];
try {
InputStream is = sc.openInputStream();
Table 5-5: Port to Serial Mapping
Port Identifier Serial
COM0 UART2
COM1 UART1
COM2 UART2
COM3 USB