An Introduction to the Java ME Project Jens A Andersson.

Slides:



Advertisements
Similar presentations
MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
Advertisements

Intermediate TCP/IP TCP Operation.
Writing Your First MIDlet Running JAVA on a Cell Phone Jon A. Batcheller January 27, 2004.
Introduction to Java 2 Micro Edition Mark Balbes, Ph.D. Senior Software Engineer Jeff Brown Senior Software Engineer.
Developing an Application with J2ME Technology Scott Palmer, Nat Panchee, Judy Sullivan, Karen Thabet, Sten Westgard.
Socket Programming.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
1 Java Networking – Part I CS , Spring 2008/9.
CSCI 4550/8556 Computer Networks Comer, Chapter 3: Network Programming and Applications.
Chapter 13 Mobile IP. Outline  ADDRESSING  AGENTS  THREE PHASES  AGENT DISCOVERY  REGISTRATION  DATA TRANSFER  INEFFICIENCY IN MOBILE IP.
Developing Software for Wireless Devices
1 © 2003, Cisco Systems, Inc. All rights reserved. CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
Chapter 15 – Part 2 Networks The Internal Operating System The Architecture of Computer Hardware and Systems Software: An Information Technology Approach.
Understanding Networks. Objectives Compare client and network operating systems Learn about local area network technologies, including Ethernet, Token.
Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc.
Introduction To Networking
STFTP (Simplified Trivial File Transfer Protocol) MODULE #1.
Developing J2ME Applications Mobile and Wireless Networks.
Cosc 4730 Phone Programming in Java An Introduction.
Design and Implementation of a Server Director Project for the LCCN Lab at the Technion.
Java 2 Platform, Micro Edition (J2ME) By Xiaorong Wang.
VSP Video Station Protocol Presented by : Mittelman Dana Ben-Hamo Revital Ariel Tal Instructor : Sela Guy Presented by : Mittelman Dana Ben-Hamo Revital.
J2ME and WAP Technologies CSCI – Independent Study Fall 2002 Presented by: Kashif Syed.
Process-to-Process Delivery:
TCP/IP protocols Communication over Internet is mostly TCP/IP (Transmission Control Protocol over Internet Protocol) TCP/IP "stack" is software which allows.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
Getting Started with JXTA for J2ME Advisor : Dr. Ching-Long Yeh Report : DI.2, 洪泰昌 ( ) Course: XML 文件管理.
1 Chapter Client-Server Interaction. 2 Functionality  Transport layer and layers below  Basic communication  Reliability  Application layer.
Michael Brockway Advanced Applications Development in Java J2ME -- Introduction l Introduction / Overview l Java 2 Micro Edition n CLDC n MIDP l Examples.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 11 J2ME and MIDlets Rob Pooley
Institute of Computer and Communication Network Engineering OFC/NFOEC, 6-10 March 2011, Los Angeles, CA Lessons Learned From Implementing a Path Computation.
Hyung-Min Lee©Networking Lab., 2001 Chapter 11 User Datagram Protocol (UDP)
1 Computer Networks DA Chapter 1-3 Introduction.
Small Devices on DBGlobe System George Samaras Chara Skouteli.
Computer Science Wi-Fi App using J2ME and MVC Architecture Advisor : Dr. Chung-E Wang Department of Computer Science Sacramento State University Date:
Internet Addresses. Universal Identifiers Universal Communication Service - Communication system which allows any host to communicate with any other host.
William Stallings Data and Computer Communications 7 th Edition Data Communications and Networks Overview Protocols and Architecture.
6.1. Transport Control Protocol (TCP) It is the most widely used transport protocol in the world. Provides reliable end to end connection between two hosts.
J2ME Presented by May Sayed & Menna Hawash. Outline Introduction “Java Technology” Introduction “What is J2ME?” J2ME Architecture J2ME Core Concepts 
Chapter Three Network Protocols By JD McGuire ARP Address Resolution Protocol Address Resolution Protocol The core protocol in the TCP/IP suite that.
1 CSC111H Client-Server: An Introduction Dennis Burford
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Ch 1. Computer Networks and the Internet Myungchul Kim
1 © 2003, Cisco Systems, Inc. All rights reserved. CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
CCNA 1 v3.0 Module 11 TCP/IP Transport and Application Layers.
1 Chapter Overview Password Protection Security Models Firewalls Security Protocols.
1 Network Firewalls CSCI Web Security Spring 2003 Presented By Yasir Zahur.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
© Paradigm Publishing, Inc. 4-1 Chapter 4 System Software Chapter 4 System Software.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
1 Introduction to J2ME Outline MIDP Building J2ME Apps- Tool J2ME Wireless Toolkit Demo MIDlet Programming -- MIDlet Transition States -- Midlet Skeleton.
Mobile Programming Mobile Programming - Ordibehesht Ordibehesht 1390.
1 Network Communications A Brief Introduction. 2 Network Communications.
How to develop a VoIP softphone in C# that enables SIP Instant Messaging (IM) This presentation describes how to create a softphone in C# that allows you.
How to develop a VoIP softphone in C# by using OZEKI VoIP SIP SDK This presentation demonstrates the first steps concerning to how to develop a fully-functional.
IST 201 Chapter 11 Lecture 2. Ports Used by TCP & UDP Keep track of different types of transmissions crossing the network simultaneously. Combination.
Advance Computer Programming Market for Java ME The Java ME Platform – Java 2 Micro Edition (J2ME) combines a resource- constrained JVM and a set of Java.
Visual Mobile Applications with Netbeans 6.0 Your Name Sun Campus Ambassador Your Address.
Visual Mobile Gaming Your Name Sun Campus Ambassador Your Address.
The Java Platform Micro Edition Java ME
Chapter 9: Transport Layer
Java N Amanquah.
Instructor Materials Chapter 9: Transport Layer
Chapter 5 Network and Transport Layers
MCA – 405 Elective –I (A) Java Programming & Technology
Process-to-Process Delivery:
Chapter 15 – Part 2 Networks The Internal Operating System
Java for Mobile Devices
CS4470 Computer Networking Protocols
Exceptions and networking
Presentation transcript:

An Introduction to the Java ME Project Jens A Andersson

2/12 Agenda  Java ME  MIDlets  NetBeans  Your task: The Application  Simple Session Protocol and SSPServer  SSP help classes  Why Threads

3/12 Java ME  Sun groupes its Java technologies into 3 editions: Java EE (Java Enterprise Edition) - servers Java SE (Java Standard Edition) – personal computers Java ME (Java Micro Edition) – mobile phones and PDAs  In this course we will use: MIDP (Mobile Information Device Profile) MIDP 1.0, 2.0, and 2.1 – backward compatible CDLC (Connected Limited Device Configuration) CLDC 1.0 and 1.1 – backward compatible

4/12 MIDlets  An application written for MIDP is called a MIDlet.  All MIDlets extend the MIDlet class: public class MyMIDlet extends MIDlet { }  The MIDlet class provides methods for starting, pausing, and terminating the MIDlet application: startApp() pauseApp() destroyApp(boolean unconditional)  The department has four Sony Ericsson K700 phones that support MIDP 2.0.

5/12 A Complete MIDlet Example import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class HelloMIDlet extends MIDlet { public void startApp() { TextBox textBox = new TextBox(“My MIDlet", "Hello world :=)",15,0); Display.getDisplay(this).setCurrent(textBox); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } }

6/12 NetBeans  NetBeans is a free and open-source IDE (Integrated Development Environment) for developing Java applications.  NetBeans runs on Windows, Linux, Mac OS, etc.  It has support for CLDC 1.0/1.1 and MIDP 1.0/2.0/2.1.  With NetBeans you can write, emulate, and debug applications for mobile phones. So they contain all you need to develop Java ME applications.

Application (overview) Peer-to-peer application:  Of your choice  Minimum: Simple chat application Two mobile devices communicate and exchange messages Session server (hub/proxy) to find other party

Application (considerations) Hub to find other party NAT makes it impossible to communicate directly between mobile devices Proxy for two-way communication (tunnelling)

Application (figure) NAT! Private addresses Global addresses

NAT & PAT NAT = Network Address Translation PAT = Port and network Address Translation

zFigure Translation Alternative: Source address goes here

Simple Session Protocol SSP UDP based Control messages Data/Tunnel messages

13/12 The SSPServer  SSP (Simple Session Protocol) is a simple protocol developed for this course.  SSPServer is a Java SE application and allows mobile phones to communicate to each other through a server.  Two ways of using the SSPServer: Download and run it locally on any computer – connect your application to port 3333 on localhost No downloading needed - connect your mobile phone to port 3333 on sspserver.eit.lth.se (public address)

SSPServer Users login/logout Holds a list of active users/opponents Controls state also on clients Reacts only on incoming packets  (no time outs) Forwards application data to other party  TUNNEL

SSP packet format TYPE ID  CONTROL 0x01 (The following data is control data)  TUNNEL 0x02 (The following data is application data) TYPE ID (1)DATA (variable)

Control Header Format CTRL TYPE ID  LOGIN REQ0x11 (The user logs in with the specified user id)  LOGIN ACC0x12 (The user login is accepted by the hub)  LOGIN REJ0x13 (The user login is rejected by the hub)  LOGIN ERR0x1f (Server in LOGIN state but receives ctrl packet for other state) TYPE ID (1) 0x01 CTRL TYPE ID (1) USER ID (8)PEER ID (8)

Control Header Format (cont)  TERMINATE REQ0x21 (The user/hub terminates and is logged out)  SETUP LST REQ0x04 (The user requests a list over available opponents from the hub)  SETUP LST RES0x05 (The hub sends a list with available opponents)

Control Header Format (cont)  SETUP REQ0x01 (The user requests the specified user as an opponent)  SETUP ACC0x02 (The user accepts request from other user)  SETUP REJ0x03 (The user rejects request from other user) These ctrl packets are forwarded by the hub to the users.

Peer lists SETUP LST RES  List of available opponents  From Hub to mobile device CONTROL HEADER (16) NBR PEERS (1)PEER1 (8) PEER2 (8)PEER3 (8)...

Tunnel Header Format USERID = you; PEERID = opponent Your application protocol goes in the DATA field TYPE ID (1 ) 0x02 RESERVED (1 )USER ID (8)PEER ID (8) DATA (variable)

Application Sequence Login to server If accepted  get user list  select peer  request session with peer If accepted  Start ”application” and data transfer in tunnel At end logout from server

SSP Java class Methods for datagram  Parse request  Build request  Validate request See API on project web page for details 

ByteString Java Class Application data type = String DatagramConnection (sending/recieving UDP datagram) uses byte[ ] ByteString: ”interface” between String and byte[ ] See API on course home page for details

Application protocol Data transfer in UDP based tunnel  Best effort! Application shall handle errors!  Time outs  Packet loss  Packet out of sequence How? You decide!  Select/Design error handling method

Tunnel Header Format Your application protocol goes in the DATA field TYPE ID (1 ) 0x02 RESERVED (1 )USER ID (8)PEER ID (8) DATA (variable)

Applications protocol (cont.) Is control information needed? Keep track of messages/datagrams/packets? How is DATA field interpreted? … This is your task for section 2

Implementation Section 3 is implementation of your application and application protocol Your application should work on mobile terminals

Threads Parallel processing  sections of code running executed “simultaneously” Mobile phone Java application already threaded!  runs main thread  Calls MIDlet methods threaded startApp, pauseApp, destroyApp commandAction

GUI GUI is handled by main thread inhibited when waiting for response in your methods  Send REQ, Get response  Wait for move from opponent GUI events must be handled!

An application MyMIDlet startApp commandAction “The Application”

An application (cont.) MyMIDlet startApp commandAction. wait for response. “The Application” GUI “stalled”

An application (cont..) MyMIDlet startApp commandAction. wait for response in thread. “The Application” GUI active

Threads (cont.) Send REQ  application waiting for GPRS setup?  application waiting for free GPRS slots?  application sending datagram? GUI blocked until Send REQ is completed

Threads (cont..) Get Response  application setup GPRS etc?  application waiting for incoming datagram?  application waiting for response from opponent? GUI blocked until Get Response request is completed

Threads (cont…) Do in parallel thread  Send REQ  Get Response In main thread  Wait for completion of parallel threads  Handle GUI exceptions

36/12 Get Started! 1) Visit the home page of the project: 2) Download the SSPServer and run it locally. 3) Download the skeleton code and run it. 4) Study and understand the structure of the skeleton code.