CS434/534: Topics in Networked (Networking) Systems

Similar documents
Android Networking and Connec1vity

Bluetooth. Mobila applikationer och trådlösa nät HI /3/2013. Lecturer: Anders Lindström,

CS434/534: Topics in Networked (Networking) Systems

CS434/534: Topics in Networked (Networking) Systems

App Development for Smart Devices. Lec #16: Networking

A Close Examina.on of Performance and Power Characteris.cs of 4G LTE Networks

INTERFACING A SENSORY MICROCONTROLLER WITH AN ANDROID SMARTPHONE

Cellular Networks and Mobile Compu5ng COMS , Spring 2012

Object-Oriented Databases Object-Relational Mappings and Frameworks. Alexandre de Spindler Department of Computer Science

Analyzing Wi Fi P2P in the context of a hangman game 1

Network Layer: Location/Service Management

Produced by. Design Patterns. MSc in Computer Science. Eamonn de Leastar

JAVA SOCKET PROGRAMMING

Termite WiFi Direct API

Optimizing Idle State Configuration to Improve Power Saving for M2M Communication over LTE Networks Mugisha Robert 1 Pravin R Patil 2

32. And this is an example on how to retrieve the messages received through NFC.

Ethernet. Lecture 6. Outline. Ethernet - Physical Properties. Ethernet - Physical Properties. Ethernet

Services. service: A background task used by an app.

Topic 2b Wireless MAC. Chapter 7. Wireless and Mobile Networks. Computer Networking: A Top Down Approach

Lecture 11. Transport Layer (cont d) Transport Layer 1

Accessing Cellular Network Efficiently Without the Battery Drain. Lee, Chang Hwan, SK Telecom lipisoft at gmail dot com Kandroid: Lipi(리피)

WiZi-Cloud: Application-transparent Dual ZigBee-WiFi Radios for Low Power Internet Access

Mobile Application (Design and) Development

POWER-ON AND POWER-OFF PROCEDURES

Lecture 6. Reminder: Homework 2, Programming Project 2 due on Thursday. Questions? Tuesday, September 13 CS 475 Networks - Lecture 6 1

CS 457 Lecture 11 More IP Networking. Fall 2011

OFFLINE MODE OF ANDROID

UTRAN Procedures. Elementary procedures. RRC connection release. Transaction reasoning

Input ports, switching fabric, output ports Switching via memory, bus, crossbar Queueing, head-of-line blocking

Lecture 10. Denial of Service Attacks (cont d) Thursday 24/12/2015

The network requirements can vary based on the number of simultaneous users the system will need to support. The most basic requirements are:

RadioJockey: Mining Program Execution to Optimize Cellular Radio Usage

BITalino Java Application Programming Interface. Documentation Android API

UTRAN Procedures. MM procedures -> see MM slides CM procedures -> see CM slides

Wireless Network Security Spring 2011

Rethinking Cellular Architecture and Protocols for IoT Communica9on

3G/4G Mobile Communications Systems. Dr. Stefan Brück Qualcomm Corporate R&D Center Germany

AT&T Developer Program Application Resource Optimizer (ARO)

Application / Document Management. MaaS360 e-learning Portal Course 3

CS519: Computer Networks. Lecture 5, Part 1: Mar 3, 2004 Transport: UDP/TCP demux and flow control / sequencing

Lessons Learned from Implementing a Wi-Fi and BT Stack

TELEPHONY CONTROL PROTOCOL SPECIFICATION

Wireless Networks. CSE 3461: Introduction to Computer Networking Reading: , Kurose and Ross

ECE 650 Systems Programming & Engineering. Spring 2018

Suprakash Datta. Office: CSEB 3043 Phone: ext Course page:

Mohammad Hossein Manshaei 1393

CSC 4900 Computer Networks: Wireless Networks

Mobile and Sensor Systems

CONFIGURATION SOFTWARE

Client/Server Computing & Socket Programming

Computer Networks II Advanced Features (T )

Different Layers Lecture 20

EveryonePrint. Mobile Gateway 4.2. Installation Guide. EveryonePrint Mobile Gateway Installation Guide Page 1 of 30

NTT DOCOMO Technical Journal

Network Guide for Listen Everywhere

Chapter 3 Transport Layer

Introduction to Android

Distributed Systems 26. Mobile Ad Hoc Mesh Networks

Traffic-aware techniques to reduce 3G/LTE wireless energy consumption

3GPP TS V7.2.0 ( ) - performs selective or soft combining of MTCH between the selected cell and the neighbouring cell.

Bluetooth: Short-range Wireless Communication

Chapter 2 Application Layer

Wireless and Mobile Networks 7-2

Quiz. Segment structure and fields Flow control (rwnd) Timeout interval. Phases transition ssthresh setting Cwnd setting

private static String TAG = BluetoothUtils.class.getSimpleName();

Communication in Distributed Systems: Sockets Programming. Operating Systems

Internet Routing Protocols, DHCP, and NAT

Lecture 2: Internet Structure

Mobile Communications. Ad-hoc and Mesh Networks

CS 355. Computer Networking. Wei Lu, Ph.D., P.Eng.

CS 3516: Advanced Computer Networks

6.9 Summary. 11/20/2013 Wireless and Mobile Networks (SSL) 6-1. Characteristics of selected wireless link standards a, g point-to-point

[MS-WFDAA]: Intellectual Property Rights Notice for Open Specifications Documentation

The Future of Lighting Is Smart. Martin Mueller Roger Sexton

Chapter 3 Transport Layer

Multi Users Text Communication (with new ideas for more utilization) using Android Smartphone Bluetooth Connection

By The Name of Allah. The Islamic University of Gaza Faculty of Engineering Computer Department Final Exam. Mobile Computing

Last time. Network layer. Introduction. Virtual circuit vs. datagram details. IP: the Internet Protocol. forwarding vs. routing

Mobile Network Evolution Part 2

Service Discovery in Pervasive Computing Environments

CS5530 Mobile/Wireless Systems Android Bluetooth Interface

CUWN Release 8.2 mdns Gateway with Chromecast Support Feature Deployment Guide

CSC 401 Data and Computer Communications Networks

ETSI TS V ( )

Router Architecture Overview

User Guide Vodafone Mobile Wi-Fi R205. Designed by Vodafone

Wi-Fi helping out Bluetooth Smart for an improved home automation user experience

LTE Radio Interface Architecture. Sherif A. Elgohari

Customer Training Catalog Training Programs WCDMA RNP&RNO

Network layer: Overview. Network layer functions IP Routing and forwarding NAT ARP IPv6 Routing

Chapter 4 Network Layer: The Data Plane

CS 332 Computer Networks Wireless Networks

EC441 Fall 2018 Introduction to Computer Networking Chapter4: Network Layer Data Plane

IoTivity Big Picture. MyeongGi Jeong Software R&D Center

Network layer: Overview. Network Layer Functions

Grandstream Networks, Inc. GWN76xx Wi-Fi Access Points Master/Slave Architecture Guide

ET4254 Communications and Networking 1

CS118 Discussion 1A, Week 9. Zengwen Yuan Dodd Hall 78, Friday 10:00 11:50 a.m.

A Close Examination of Performance and Power Characteristics of 4G LTE Networks

Primebit Solution EXPERT DIPLOMA IN PROTOCOL TESTING COURSE CONTENT

Transcription:

CS434/534: Topics in Networked (Networking) Systems Mobile Networking System: Making Connections: Bluetooth; WiFi Direct; Cellular Yang (Richard) Yang Computer Science Department Yale University 208A Watson Email: yry@cs.yale.edu http://zoo.cs.yale.edu/classes/cs434/

Admin. Project planning Start: Apr. 5 A meeting w/ instructor; Due: team, potential topics Checkpoint I: Apr. 13 (updated; Thursday) Initial ideas; survey of related work; feedback from instructor/tf Checkpoint II: Apr. 20 (updated) Initial design; feedback from instructor/tf Checkpoint III: Apr. 27 (updated) Design refined; key components details Final report: May 4 No more than 6 page write up 2

%adb shell ls /sys/kernel/debug/binder see transactions The Binder Protocol If one process sends data to another process, it is called transaction. The data is called transaction data.

Recap: Binder + Service Manager $ adb shell service list lclient lixxx lservice Manager lservice list lname:handle l1 lserver lontransact( ) l2 lname:handle lthread pool lhandle=0 lname:handle ltransact( ) l3 l4 l5 luser Spac lkernel Sp lbinder Driver: /dev/binder lmemory mapping 4

Recap: Network Service Discovery and Execution request src dst result service location SD 5

Recap: The Linda Paradigm Naming scheme: o arbitrary tuples (heterogeneous-type vectors) Name resolution: o Nodes write into shared memory o Nodes read matching tuples from shared memory exact matching is required for extraction 6

Recap: DNS clients DNS <name, service> routers IP address servers 7

Recap: DNS-Service Discovery Leverage DNS message format, but each node can announce its own services Multicast in a small world no central address server each node is a responder link-local addressing send to multicast address: 224.0.0.251 169.254.1.219 169.254.4.51 Network Printer 169.254.10.29 8

Outline Admin Android Platform overview Basic concepts Inter-thread: execution model with multiple threads Inter-process: component composition Inter-machine: network-wise composition Service discovery Make connections Making standard connection: TCP Socket 9

TCP Socket Big Picture -Welcome socket: the waiting room -connsocket: the operation room 10

Client/server Socket Workflow: TCP Server (running on hostid) Client create socket, port=x, for incoming request: welcomesocket = ServerSocket(x) wait for incoming connection request connectionsocket = welcomesocket.accept() TCP connection setup create socket, connect to hostid, port=x clientsocket = Socket() read request from connectionsocket write reply to connectionsocket close connectionsocket send request using clientsocket read reply from clientsocket close clientsocket

Outline Admin Android Platform overview Basic concepts Inter-thread: execution model with multiple threads Inter-process: component composition Inter-machine: network-wise composition Service discovery Make connections Making standard connection: TCP Socket Bluetooth 12

Recall: Bluetooth Physical Layer Nodes form piconet: one master and upto 7 slaves Each radio can function as a master or a slave The slaves discover the master and follow the pseudorandom jumping sequence of the master A piconet 13

Bluetooth Details Each BT device is identified by a 48 bit MAC address Operation Device Discovery Inquiry scan (Sender. at faster jumping freq than recv) Connection Pairing Inquiry scan: get device address; Page Scan: Use dest hop seq Authentication/share keys; after pairing, they become bonded 14

Bluetooth Profiles Src: http://www.althos.com/tutorial/bluetooth-tutorial-hands-free-profile.html 15

Example: Handfree Profile 16

Bluetooth Software Framework Design in Android Discussion: How may Bluetooth be supported in Android? https://developer.android.com/guide/topics/connectivity/bluetooth.html 17

Bluetooth Software Framework Design in Android Announce permission <manifest... > <uses-permission android:name="android.permission.bluetooth" /> <uses-permission android:name="android.permission.bluetooth_admin" />... </manifest> Use intents to turn on BT, request discoverable Intent enablebtintent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startactivityforresult(enablebtintent, REQUEST_ENABLE_BT); Intent discoverableintent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); discoverableintent.putextra(bluetoothadapter.extra_discoverable_duration, 300); startactivity(discoverableintent); https://developer.android.com/guide/topics/connectivity/bluetooth.html 18

Accessor: Query Paired (Bonded) Devices Set<BluetoothDevice> paireddevices = mbluetoothadapter.getbondeddevices(); if (paireddevices.size() > 0) { // There are paired devices. Get the name and address of each paired device. for (BluetoothDevice device : paireddevices) { String devicename = device.getname(); String devicehardwareaddress = device.getaddress(); // MAC address } } 19

Accessor: Notified as Device Being Discovered @Override protected void oncreate(bundle savedinstancestate) {... } // Register for broadcasts when a device is discovered. IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND); registerreceiver(mreceiver, filter); // Create a BroadcastReceiver for ACTION_FOUND. private final BroadcastReceiver mreceiver = new BroadcastReceiver() { public void onreceive(context context, Intent intent) { String action = intent.getaction(); if (BluetoothDevice.ACTION_FOUND.equals(action)) { // Discovery has found a device. Get the BluetoothDevice // object and its info from the Intent. BluetoothDevice device = intent.getparcelableextra(bluetoothdevice.extra_device); String devicename = device.getname(); String devicehardwareaddress = device.getaddress(); // MAC address } } }; 20

Mutator: Connecting as Server private class AcceptThread extends Thread { private final BluetoothServerSocket mmserversocket; public AcceptThread() { // Use a temporary object that is later assigned to mmserversocket // because mmserversocket is final. BluetoothServerSocket tmp = null; try { // MY_UUID is the app's UUID string, also used by the client code. tmp = mbluetoothadapter.listenusingrfcommwithservicerecord(sname, MY_UUID); } catch (IOException e) { Log.e(TAG, "Socket's listen() method failed", e); } mmserversocket = tmp; } public void run() { BluetoothSocket socket = null; // Keep listening until exception occurs or a socket is returned. while (true) { try { socket = mmserversocket.accept(); } catch (IOException e) { Log.e(TAG, "Socket's accept() method failed", e); break; } } // Closes the connect socket and causes the thread to finish. public void cancel() { try { mmserversocket.close(); } catch (IOException e) { Log.e(TAG, "Could not close the connect socket", e); } } } } if (socket!= null) { // A connection was accepted. Perform work associated with // the connection in a separate thread. managemyconnectedsocket(socket); mmserversocket.close(); break; } 21

Mutator: Connecting as Client private class ConnectThread extends Thread { private final BluetoothSocket mmsocket; private final BluetoothDevice mmdevice; public ConnectThread(BluetoothDevice device) { // Use a temporary object that is later assigned to mmsocket // because mmsocket is final. BluetoothSocket tmp = null; mmdevice = device; } try { // Get a BluetoothSocket to connect with the given BluetoothDevice. // MY_UUID is the app's UUID string, also used in the server code. tmp = device.createrfcommsockettoservicerecord(my_uuid); } catch (IOException e) { Log.e(TAG, "Socket's create() method failed", e); } mmsocket = tmp; public void run() { // Cancel discovery because it otherwise slows down the connection. mbluetoothadapter.canceldiscovery(); } try { // Connect to the remote device through the socket. This call blocks // until it succeeds or throws an exception. mmsocket.connect(); } catch (IOException connectexception) { // Unable to connect; close the socket and return. try { mmsocket.close(); } catch (IOException closeexception) { Log.e(TAG, "Could not close the client socket", closeexception); } return; } // The connection attempt succeeded. Perform work associated with // the connection in a separate thread. managemyconnectedsocket(mmsocket); } // Closes the client socket and causes the thread to finish. public void cancel() { try { mmsocket.close(); } catch (IOException e) { Log.e(TAG, "Could not close the client socket", e); } } 22

(Offline) Remaining Design Issue How may you design a software framework supporting BT profiles? 23

Outline Admin Android Platform overview Basic concepts Inter-thread: execution model with multiple threads Inter-process: component composition Inter-machine: network-wise composition Service discovery Make connections Bluetooth WiFi Direct also called WiFi P2P 24

WiFi Direct Initial support by a major vendor: Intel in their Centrino 2 platform in 2008 Google announced Wi-Fi Direct support in Android 4.0 in October 2011 Xbox in Xbox One in 2013 Windows 8 on PC ios has its own proprietary feature 25

WiFi Direct: Basic Ideas Essentially embeds a software access point ("Soft AP"), into any device that must support Direct. The soft AP provides a version of Wi-Fi Protected Setup with its push-button or PINbased setup Only one device needs to be aware of WiFi Direct Allow devices to form groups https://briolidz.wordpress.com/2012/01/10/wi-fi-protected-setup-wps/ 26

Deployment 27

Group Formation: Standard See backup slides on other types of Group Formation 28

WPS Provisioning See https://en.wikipedia.org/wiki/wi-fi_protected_setup 29

Discussion: Software API Design https://developer.android.com/guide/topics/ connectivity/wifip2p.html 30

WiFi Direct Software Framework (Android) Setup permission in Manifest Create IntentFilter and Broadcast Receiver intentfilter.addaction WIFI_P2P_STATE_CHANGED_ACTION WIFI_P2P_PEERS_CHANGED_ACTION In life cycle WIFI_P2P_CONNECTION_CHANGED_ACTION WIFI_P2P_THIS_DEVICE_CHANGED_ACTION /** register the BroadcastReceiver with the intent values to be matched */ @Override public void onresume() { super.onresume(); receiver = new WiFiDirectBroadcastReceiver(mManager, mchannel, this); registerreceiver(receiver, intentfilter); } Initiate @Override public void onpause() { super.onpause(); unregisterreceiver(receiver); } Call discoverpeers mmanager.discoverpeers(mchannel, new WifiP2pManager.ActionListener() { Call connect requestgroupinfo 31

Outline Admin Android Platform overview Basic concepts Inter-thread: execution model with multiple threads Inter-process: component composition Inter-machine: network-wise composition Service discovery Make connections WiFi Direct Cellular connect 32

Recall: GSM Logical Channels and Request Many link layers use a hybrid approach Mobile device uses random access to request radio resource The device holds the radio resource during a session call setup from an MS MS BTS RACH (request signaling channel) AGCH (assign signaling channel) SDCCH (request call setup) SDCCH message exchange SDCCH (assign TCH) Communication 33

RRC State Management in UMTS Given the large overhead to set up radio resources, UMTS implements RRC state machine on mobile devices for data connection IDLE CELL_FACH CELL_DCH Channel Not allocated Shared, Low Speed Dedicated, High Speed Radio Power Almost zero Low High https://developer.android.com/training/efficient-downloads/efficient-network-access.html Courtesy: Erran Li. 34

RRC of a Large Commercial 3G Net DCH Tail: 5 sec FACH Tail: 12 sec Promo Delay: 2 Sec Tail Time: waiting inactivity timers to expire DCH: High Power State (high throughput and power consumption) FACH: Low Power State (low throughput and power consumption) IDLE: No radio resource allocated 35

RRC Effects on Device/Network FACH and DCH Wasted Radio Energy 34% Wasted Channel Occupation Time 33% 36

Case Study: Pandora Streaming Problem: High resource overhead of periodic audience measurements (every 1 min) Recommendation: Delay transfers and batch them with delay-sensitive transfers 37

Case Study: Google Search UL Packets DL Packets Bursts Usr Input RRC States Search three key words. ARO computes energy consumption for three phases I: Input phase S: Search phase T: Tail Phase Problem: High resource overhead of query suggestions and instant search Recommendation: Balance between functionality and resource when battery is low 38

Summary App developers may not be aware of interactions with underlying network radio resource management See backup slides on Radio Resource Control (RRC) on 3G and LTE A good topic to think about as a part of your project 39

Backup Slides 40

Other Types of WiFi Group Formation Settings 41

Wifi Direct Group Formation: Autonomous Group 42

WiFi Direct Group Formation: Persistent 43

Eval: Formation Types Comparison 44

RRC State Transition in 3G and LTE 45

Radio Resource Control Setup for Data in 3G RRC connection setup: ~ 1sec + Radio Bearer Setup: ~ 1 sec Figure source: HSDPA/HSUPA for UMTS: High Speed Radio Access for Mobile Communications. John Wiley and Sons, Inc., 2006. Source: Erran Li. 46

RRC State Transitions in LTE Continuous Reception Short DRX Ti Tis Long DRX Ttail DRX RRC_CONNECTED Timer expiration RRC_IDLE Data transfer 47

RRC State Transitions in LTE RRC_IDLE Continuous Reception No radio resource allocated Ti Low power state: 11.36mW average power Tis Short Promotion delay from Long DRX RRC_IDLE to DRX RRC_CONNECTED: 260ms Ttail DRX RRC_CONNECTED Timer expiration RRC_IDLE Data transfer 48

RRC state transitions in LTE Continuous Reception RRC_CONNECTED Radio resource allocated Short DRX Ti Tis Long DRX Power state is a function of data rate: DRX Ttail 1060mW is the base power consumption Up to 3300mW transmitting at full speed RRC_CONNECTED Timer expiration Cellular Networks and Mobile Computing (COMS 6998-11) RRC_IDLE Data transfer Courtesy: Junxian Huang et al. 49

RRC state transitions in LTE Continuous Reception Short DRX Ti Tis Long DRX Ttail Reset Ttail DRX RRC_CONNECTED Timer expiration Cellular Networks and Mobile Computing (COMS 6998-11) RRC_IDLE Data transfer Courtesy: Junxian Huang et al. 50

RRC state transitions in LTE Continuous Reception Short DRX Ti Tis Long DRX RRC_CONNECTED Timer expiration Cellular Networks and Mobile Computing (COMS 6998-11) Ttail DRX Ttail stops Demote to RRC_IDLE RRC_IDLE Data transfer Courtesy: Junxian Huang et al. 51