Example: quiz answers

Android NetworkProgramming: Introduction

Android Network programming : Introduction Douglas C. Schmidt ~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Network programming Douglas C. Schmidt 2 Explore the motivations for & challenges of networked software Introduction Networked software defines protocols that enable computing devices to exchange messages & perform services remotely Network programming Douglas C. Schmidt 3 Explore the motivations for & challenges of networked software Describe the Android mechanisms available to implement apps & services that communicate across process boundaries that span mobile devices & server hosts Introduction Network programming Douglas C.

Android NetworkProgramming: Introduction . Douglas C. Schmidt . d.schmidt@vanderbilt.edu ... Network Programming Douglas C. Schmidt 4 Socket Socket . ... Introduction • Explore the motivations for & challenges of networked software

Tags:

  Introduction, Programming, Sockets, Android, Android networkprogramming, Networkprogramming, Socket socket

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Android NetworkProgramming: Introduction

1 Android Network programming : Introduction Douglas C. Schmidt ~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Network programming Douglas C. Schmidt 2 Explore the motivations for & challenges of networked software Introduction Networked software defines protocols that enable computing devices to exchange messages & perform services remotely Network programming Douglas C. Schmidt 3 Explore the motivations for & challenges of networked software Describe the Android mechanisms available to implement apps & services that communicate across process boundaries that span mobile devices & server hosts Introduction Network programming Douglas C.

2 Schmidt 4 socket socket See Introduction Explore the motivations for & challenges of networked software Describe the Android mechanisms available to implement apps & services that communicate across process boundaries Many Android apps use sockets & TCP and/or HTTP to communicate & exchange data via the Internet , Browser, Email, MMS/SMS, Calendar, Contacts, etc. Network programming Douglas C. Schmidt 5 Explore the motivations for & challenges of networked software Describe the Android mechanisms available to implement apps & services that communicate across process boundaries Many Android apps use sockets & TCP and/or HTTP to communicate & exchange data via the Internet Android also provides certain IPC mechanisms that are optimized for inter-process communicate within a mobile device , the Android Interface Definition Language (AIDL) & Binder framework We ll cover the the Android Binder & AIDL in later modules Introduction DownloadActivity downloadImage() mBoundService DownloadService Process A Process B LocalBinder Binder IPC Mechanism 1: Call method downloadImage() 2.

3 Return results to caller Android Network programming : Part 1 Douglas C. Schmidt ~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Network programming Douglas C. Schmidt 7 Learning Objectives in this Part of the Module Understand the motivations for & challenges of networked software Network programming Douglas C. Schmidt 8 CLIENTS Motivations for Networked Software Collaboration & commerce , file sharing, social media, e-commerce online transaction processing, B2B supply chain management, etc. Network programming Douglas C. Schmidt 9 CLIENTS Motivations for Networked Software Collaboration & commerce Scalability , utility computing in clouds has many apt examples Network programming Douglas C.

4 Schmidt 10 Motivations for Networked Software Collaboration & commerce Scalability Availability , minimizing single points of failure via replication CLIENTS Network programming Douglas C. Schmidt 11 Motivations for Networked Software Collaboration & commerce Scalability Availability Cost effectiveness , via shared resources CLIENTS Network programming Douglas C. Schmidt 12 Challenges for Networked Software Accidental Complexities Algorithmic decomposition has more info Algorithmic decomposition is a historically popular design method that structures the software based on the actions performed by the system Network programming Douglas C. Schmidt 13 Challenges for Networked Software Accidental Complexities Algorithmic decomposition Continuous re-discovery & re-invention of core components See for more Network programming Douglas C.

5 Schmidt 14 Challenges for Networked Software Accidental Complexities Algorithmic decomposition Continuous re-discovery & re-invention of core components Inherent Complexities Latency & jitter Network programming Douglas C. Schmidt 15 Challenges for Networked Software Accidental Complexities Algorithmic decomposition Continuous re-discovery & re-invention of core components Inherent Complexities Latency & jitter Reliability & partial failure Error detection & handling is more complicated for networked software Network programming Douglas C. Schmidt 16 Challenges for Networked Software Accidental Complexities Algorithmic decomposition Continuous re-discovery & re-invention of core components Inherent Complexities Latency & jitter Reliability & partial failure Security See ~schmidt/ for more info Network programming Douglas C.

6 Schmidt 17 Summary Networked software helps Leverage advances in hardware & networking technology Meet the quality & performance needs of apps & services Network programming Douglas C. Schmidt 18 Summary Networked software helps Leverage advances in hardware & networking technology Meet the quality & performance needs of apps & services Successful networked software solutions must address key accidental & inherent complexities arising from Limitations with development tools/techniques Fundamental domain challenges Network programming Douglas C. Schmidt 19 Summary Networked software helps Leverage advances in hardware & networking technology Meet the quality & performance needs of apps & services Successful networked software solutions must address key accidental & inherent complexities arising from Limitations with development tools/techniques Fundamental domain challenges As networked systems have grown in scale & functionality they must cope with a broader & more challenging set of complexities Android Network programming : Part 2 Douglas C.

7 Schmidt ~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Network programming Douglas C. Schmidt 21 Learning Objectives in this Part of the Module Understand the foundational network programming mechanisms in Android socket socket Network programming Douglas C. Schmidt 22 Overview of Android Network programming Android includes multiple network programming classes, , (Socket, URL, etc.) (HttpRequest, HttpResponse, etc.) (AndroidHttpClient, URI, AudioStream, etc.) Network programming Douglas C. Schmidt 23 Overview of Android Network programming Android includes multiple network programming classes, , (Socket, URL, etc.)

8 (HttpRequest, HttpResponse, etc.) (AndroidHttpClient, URI, AudioStream, etc.) Under the hood, Android s HTTP libraries use the Java sockets API A socket is a software endpoint that can create a bi-directional reliable communication link between software processes socket socket sockets are a common programming interface for network communication Network programming Douglas C. Schmidt 24 Overview of Android Network programming Android includes multiple network programming classes, , (Socket, URL, etc.) (HttpRequest, HttpResponse, etc.) (AndroidHttpClient, URI, AudioStream, etc.) Under the hood, Android s HTTP libraries use the Java sockets API Even deeper under the hood Android s implementation uses the Linux C Socket API via JNI socket socket has more info on JNI Network programming Douglas C.

9 Schmidt 25 Overview of Java sockets Represents a server-side factory that waits for incoming client connections & creates connected sockets Network 1: Passive Role ServerSocket accept() bind() close() Socket Network programming Douglas C. Schmidt 26 Overview of Java sockets Plays a portion of the Acceptor role in the Acceptor-Connector pattern Network 1: Passive Role ServerSocket accept() bind() close() ~schmidt/ has more info Socket Network programming Douglas C. Schmidt 27 Provides a client-side Overview of Java sockets Network Socket bind() close() connect() getInputStream() getOutputStream() 2: Active Role 1: Passive Role ServerSocket accept() bind() close() Socket Provides a client-side (& server-side) TCP socket Network programming Douglas C.

10 Schmidt 28 Overview of Java sockets Network Socket bind() close() connect() getInputStream() getOutputStream() 2: Active Role 1: Passive Role ServerSocket accept() bind() close() Socket Provides a client-side Provides a client-side Clients & servers designate their addresses with an InetAddress Network programming Douglas C. Schmidt 29 Overview of Java sockets Network 1: Passive Role ServerSocket accept() bind() close() socket socket bind() close() connect() getInputStream() getOutputStream() 2: Active Role InputStream & OutputStream are used to exchange bytes on connected sockets 3: Communication Role has more info Network programming Douglas C. Schmidt 30 InputStream in Android An InputStream is a stream of incoming byte data An InputStream can be obtained from a Socket by using the getInputStream() method To read from a stream, you must create a byte buffer to read in data Each call to read on an InputStream fills your buffer with data & returns the number of bytes read InputStream in = (); const int BUFSIZ = 1024; byte[] buffer = new byte[BUFSIZ]; for(int bytesRead; (bytesRead = (buffer,0, )) !)


Related search queries