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.
@2011 Mihail L. Sichitiu1 Android Introduction Hello Socket Programming TCP and UDP.
 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.
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)
CEG3185 Tutorial 4 Prepared by Zhenxia Zhang Revised by Jiying Zhao (2015w)
2: Application Layer 1 Socket Programming TCP and UDP.
Socket Programming in Java -First Step of Network Programming-
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.
Vassil Roussev 2 A socket is the basic remote communication abstraction provided by the OS to processes. controlled by operating system.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
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.
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.
1 COMP 431 Internet Services & Protocols Client/Server Computing & Socket Programming Jasleen Kaur February 2, 2016.
Socket programming in C. Socket programming Socket API introduced in BSD4.1 UNIX, 1981 explicitly created, used, released by apps client/server paradigm.
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.
Socket Programming Ameera Almasoud
Echo Networking COMP
Android – Event Handling
EE2E1. JAVA Programming Revision Lecture.
Block 14 Group Communication (Multicast)
Client-server Programming
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.
Android Introduction Hello Threads.
Advanced Java Programming
Lecture 11 Socket Programming.
Programming in Java Text Books :
Chapter 12 Exception Handling and Text IO
Exceptions Problems in a Java program may cause exceptions or errors representing unusual or invalid processing. An exception is an object that defines.
Exception Handling Oo28.
Software Engineering for Internet Applications
Socket Programming.
TA: Donghyun (David) Kim
An Introduction to Internetworking
Chapter 5 멀티스레드 u-Network Design Lab 4.
Chapter 5 & 6 UDP 서버/클라이언트 u-Network Design Lab 5.
CPSC 441 UDP Socket Programming
Android Development Introduction to Android Development 2011/01/16
PHP-II.
CMSC 202 Exceptions.
CS18000: Problem Solving and Object-Oriented Programming
Exceptions and networking
Based on Java Network Programming and Distributed Computing
CA16R405 - Mobile Application Development (Theory)
Presentation transcript:

Hello Socket Programming TCP and UDP Android Introduction Hello Socket Programming TCP and UDP

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

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)

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

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(); }

Running it First give the application INTERNET permissions (like in the WebView) Implement the UDP and TCP functionality separately Run and debug.