3- socket_and_android

3- socket_and_android - CSE 486/586 Distributed Systems...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Socket Programming and Android Steve Ko Computer Sciences and Engineering University at Buffalo
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 486/586, Spring 2012 Last Time What to put on top of physical networks? Layers providing survivability Where to put functionalities? Fate-sharing & end-to-end arguments IP layer doesn’t provide much TCP handles most of the survivability issues : the two transport protocols of the Internet What interface do applications see? Socket API 2
Background image of page 2
CSE 486/586, Spring 2012 Today Today: background for programming assignments Socket programming, Android, and project overviews It’s imperative that you try yourself! If you have no clue at the end of the lecture, please stop by my office. Goal: today’s really about transferring basic knowledge , less about design decisions. 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 486/586, Spring 2012 Today’s Question TCP provides a reliable, byte-stream connection as an abstraction. UDP gives raw access to what the IP network provides without all the overhead of TCP. So, how do we program applications on top of these abstractions? 4
Background image of page 4
CSE 486/586, Spring 2012 What Applications See 5 TCP UDP IP Device Drivers Network Interface OS App Socket API
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 486/586, Spring 2012 6 UNIX Socket API Socket interface Originally provided in Berkeley UNIX Later adopted by all popular operating systems Simplifies porting applications to different OSes In UNIX, everything is like a file All input is like reading a file All output is like writing a file File is represented by an integer file descriptor API implemented as system calls E.g., socket(), connect(), listen(), read(), write(), close(), … Will look at the details of these system calls
Background image of page 6
CSE 486/586, Spring 2012 So, Let’s Consider a Scenario What is the server address? IP address How do we identify the Web server? Port number 7 OS Socket API OS Socket API IP network
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 486/586, Spring 2012 8 Using Ports to Identify Services Web server ( port 80 ) Client host Server host 128.2.194.242 Echo server (port 7) Service request for 128.2.194.242 : 80 (i.e., the Web server) Web server (port 80) Echo server ( port 7 ) Service request for 128.2.194.242 : 7 (i.e., the echo server) OS OS Client Client
Background image of page 8
CSE 486/586, Spring 2012 9 Knowing What Port Number To Use Popular applications have well-known ports E.g., port 80 for Web and port 25 for e-mail See http://www.iana.org/assignments/port-numbers Well-known vs. ephemeral ports Server has a well-known port (e.g., port 80) » Between 0 and 1023 Client picks an unused ephemeral (i.e., temporary) port » Between 1024 and 65535 Uniquely identifying the traffic between the hosts Two IP addresses and two port numbers Underlying transport protocol (e.g., TCP or UDP)
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE 486/586, Spring 2012 10 Typical Client Program E.g. browser Prepare to communicate Create a socket
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 35

3- socket_and_android - CSE 486/586 Distributed Systems...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online