Java's Generic Connection Framework 
by Paul Tremblett 

Listing One
try {
  socket = (InputConnection)Connector.open("socket://127.0.0.1:13",
             Connector.READ, true);
  is = socket.openInputStream();
}
catch (Exception e) {
}
try {
  int b;
  StringBuffer sb = new StringBuffer();
  while ( (b = is.read()) != -1) {
    sb.append((char)b);
  }
  socket.close();
  dt.setText(sb.toString());
  display.setCurrent(outputForm);
}
catch (Exception e) {
}


Listing Two
String url = "serversocket://:9191";
public MessageThread() {
  try {
    scn = (StreamConnectionNotifier)Connector.open(url);
  }
  catch (IOException e) {
  }
}

Listing Three

(a)
String url = "http://localhost/J2MEBOOK/servlet/CountServlet";

(b)
conn.setRequestMethod(HttpConnection.POST);
conn.setRequestProperty("User-Agent", 
  "Profile/MIDP-1.0 Configuration/CLDC-1.0");
conn.setRequestProperty("Content-type", 
  "application/x-www-form-urlencoded");






1

