@2011 Mihail L. Sichitiu1 Android Introduction Hello Socket Programming TCP and UDP.

Slides:



Advertisements
Similar presentations
1 Android Introduction Hello Threads. 2 Goal Create an application that uses a background thread as a UDP server to receive messages from the UDP client.
Advertisements

SOCKET PROGRAMMING WITH MOBILE SOCKET CLIENT DEARTMENT OF COMPUTER SCIENCE IOWA STATE UNIVERSITY.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
 User Interface - Raeha Sandalwala.  Introduction to UI  Layouts  UI Controls  Menus and ‘Toasts’  Notifications  Other interesting UIs ◦ ListView.
Prepared By: Eng. Ola M. Abd El-Latif May/2010.  In this Lab we will answer the most frequently asked questions about programming sockets in Java. 
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 17 Introduction to the Application.
1 Overview r Socket programming with TCP r Socket programming with UDP r Building a Web server.
System Programming Practical session 10 Java sockets.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L24 (Chapter 25) Networking.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L22 (Chapter 25) Networking.
2: Application Layer1 Socket Programming. 2: Application Layer2 Socket-programming using TCP Socket: a door between application process and end- end-transport.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 25 Networking.
Chapter 7 Improving the User Interface
VSP Video Station Protocol Presented by : Mittelman Dana Ben-Hamo Revital Ariel Tal Instructor : Sela Guy Presented by : Mittelman Dana Ben-Hamo Revital.
Julia Ljunbjörk and Anita Mugenyi. What is a socket? Like a house Between the layers.
Android Development (Basics)
@2011 Mihail L. Sichitiu1 Android Introduction Application Fundamentals.
@2010 Mihail L. Sichitiu1 Android Introduction Hello Localization.
CEG3185 Tutorial 4 Prepared by Zhenxia Zhang Revised by Jiying Zhao (2015w)
19-Aug-15 About the Chat program. 2 Constraints You can't have two programs (or two copies of the same program) listen to the same port on the same machine.
2: Application Layer 1 Socket Programming TCP and UDP.
Socket Programming in Java -First Step of Network Programming-
Socket Programming References: redKlyde ’ s tutorial set Winsock2 for games (gamedev.net)
CIS 270—Application Development II Chapter 13—Exception Handling.
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
 Socket  The combination of an IP address and a port number. (RFC 793 original TCP specification)  The name of the Berkeley-derived application programming.
Basic Java Programming CSCI 392 Week Two. Stuff that is the same as C++ for loops and while loops for (int i=0; i
Vassil Roussev 2 A socket is the basic remote communication abstraction provided by the OS to processes. controlled by operating system.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
Lecture 9 Network programming. Manipulating URLs URL is an acronym for Uniform Resource Locator and is a reference (an address) to a resource on the Internet.
1 Chapter 28 Networking. 2 Objectives F To comprehend socket-based communication in Java (§28.2). F To understand client/server computing (§28.2). F To.
1 Network Programming and Java Sockets. 2 Network Request Result a client, a server, and network Client Server Client machine Server machine Elements.
L 2 - 1 3( 1/ 20) : Java Network Programming. The Socket API The previous contents describe client-server interaction that application programs use when.
Introduction to Sockets “A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port.
Java Sockets Tutorial Rahul Malik Nov 12, 2005.
User Interface Android Club Agenda Button OnClickListener OnLongClickListener ToggleButton Checkbox RatingBar AutoCompleteTextView.
@2010 Mihail L. Sichitiu1 Android Introduction Hello Threads.
Select (drop-down list) Inputs. Insert/Form/List Menu.
Java Server Programming Web Interface for Java Programs.
Designing user interfaces using: Simple views 1. Views Basic views – TextView – EditText – Button – ImageButton – CheckBox – ToggleButton – RadioButton.
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
1 Netprog 2002 TCP/IP UDP/IP in Java Based on Java Network Programming and Distributed Computing.
Prepared by Dr. Jiying Zhao University of Ottawa Canada.
Introduction to Android Programming. Essentials Eclipse and Java SDK – downloads/index.html
1 COMP 431 Internet Services & Protocols Client/Server Computing & Socket Programming Jasleen Kaur February 2, 2016.
1 Lecture 9: Network programming. 2 Manipulating URLs URL is an acronym for Uniform Resource Locator and is a reference (an address) to a resource on.
Socket Programming in Java -First Step of Network Programming-
Socket programming in C. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
Li Tak Sing COMPS311F. Case study: a multithreaded chat server The source contains 3 files: ChatServer //the chat server ChatThread //the thread on the.
SOCKET PROGRAMMING WITH JAVA By Collin Donaldson.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 33 Networking.
Socket Programming original by Joonbok Lee KAIST heavily adapted by /Jens.
Echo Networking COMP
Android – Event Handling
Beyond HTTP Up to this point we have been dealing with software tools that run on browsers and communicate to a server that generates files that can be.
Hello Socket Programming TCP and UDP
Android Introduction Hello Threads.
Programming in Java Text Books :
Exceptions Problems in a Java program may cause exceptions or errors representing unusual or invalid processing. An exception is an object that defines.
Software Engineering for Internet Applications
Chapter 5 멀티스레드 u-Network Design Lab 4.
Chapter 5 & 6 UDP 서버/클라이언트 u-Network Design Lab 5.
Android Development Introduction to Android Development 2011/01/16
CMSC 202 Exceptions.
Based on Java Network Programming and Distributed Computing
CA16R405 - Mobile Application Development (Theory)
Presentation transcript:

@2011 Mihail L. Sichitiu1 Android Introduction Hello Socket Programming TCP and UDP

@2010 Mihail L. Sichitiu2 Goal  Convert the Java Socket Programming Project to Android Text input from the user – sent to the same server(s) as before Answer from the server(s) Sends the input from the user to the UPD Server Sends the input from the user to the TCP Server

@2010 Mihail L. Sichitiu3 Layout  Create a simple layout that will include the required elements:  EditText  TextView  Buttons  Register one “OnClickedListener()” for each of the buttons  Test functionality (make a toast for each listener)

@2010 Mihail L. Sichitiu4 Socket Programming  Define most variables as members of the main Activity Class  Rename:  DatagramSocket clientSocket -> DatagramSocket udpClientSocket  Socket clientSocket -> Socket tcpSocket;  Adapt the code from pure Java to Android (especially the input and output strings) by filling in the two OnClickListeners

@2010 Mihail L. Sichitiu5 Handling Exceptions  Many network operations throw exceptions (as they can fail). In the original code they were just thrown out of main – in Android we have to handle them!  Try{ Operations that may fail and throw an exception; }catch (Exception e) { Log.e(TAG,"Caught UDP Exception: “ + e.getMessage()); Toast.makeText(HelloNets.this, "UDP Error"+ e.getMessage()), Toast.LENGTH_LONG).show(); }

@2010 Mihail L. Sichitiu6 Running it  First give the application INTERNET permissions (like in the WebView)  Implement the UDP and TCP functionality separately  Run and debug.