자바네트워크 제 13 주 URLConnection 클래스 IP 멀티캐스팅 소켓. 여러분들의 질문 지난 주 실습 내용 질문.

Slides:



Advertisements
Similar presentations
Networking with Java 1. Introduction to Networking 2.
Advertisements

Multiplexing/Demux. CPSC Transport Layer 3-2 Multiplexing/demultiplexing application transport network link physical P1 application transport network.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Addressing the Network – IPv4 Network Fundamentals – Chapter 6.
Introduction to TCP/IP TCP / IP –including 2 protocols Protocol : = a set of rules that govern the communication between different devices Protocol : =
© 2007 Cisco Systems, Inc. All rights reserved. Valašské Meziříčí Connecting to the Network.
Module 4: Configuring Network Connectivity
COMP201 Java Programming Part III: Advanced Features Topic 14: Networking Volume II,Chapter 3.
Prepared By E. Musa Alyaman1 URLs, InetAddresses, and URLConnections Chapter 9.
Java Sockets Source:
COMP201 Java Programming Part III: Advanced Features Topic 13: Networking Volume II,Chapter 3.
Socket Programming.
1 Java Networking – Part I CS , Spring 2008/9.
1 Networking with Java 2: The Server Side. 2 Some Terms Mentioned Last Week TCP -Relatively slow but enables reliable byte-stream transmission UDP -Fast.
Java Socket Support Presentation by: Lijun Yuan Course Number: cs616.
CIS – Spring Instructors: Geoffrey Fox, Bryan Carpenter Computational Science and.
Client/Server In Java An Introduction to TCP/IP and Sockets.
CSCE 515: Computer Network Programming Chin-Tser Huang University of South Carolina.
1 Server-Client communication without connection  When the communication consists of sending and/or receiving datagram packets instead of a data stream.
13-Jul-15 Sockets and URLs. 2 Sockets A socket is a low-level software device for connecting two computers together Sockets can also be used to connect.
CEG3185 Tutorial 4 Prepared by Zhenxia Zhang Revised by Jiying Zhao (2015w)
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Addressing the Network – IPv4 Network Fundamentals – Chapter 6.
IX. Multicast Sockets.
An program As a simple example of socket programming we can implement a program that sends to a remote site As a simple example of socket.
Multicast Sockets What is a multicast socket?
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Appendix F: Network Programming in Java ©SoftMoore ConsultingSlide 1.
Simple Web Services. Internet Basics The Internet is based on a communication protocol named TCP (Transmission Control Protocol) TCP allows programs running.
Application Protocols: HTTP CSNB534 Semester 2, 2007/2008 Asma Shakil.
Chapter 1: Introduction to Web Applications. This chapter gives an overview of the Internet, and where the World Wide Web fits in. It then outlines the.
1 Kyung Hee University Prof. Choong Seon HONG IP Addressing : Classful Addressing.
DBI Representation and Management of Data on the Internet.
Introduction to Network Programming with Sockets Network Programming Kansas State University at Salina.
Chapter 4 IP Addressing : Classful Addressing
The Inter-network is a big network of networks.. The five-layer networking model for the internet.
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.
Lector: Aliyev H.U. Lecture №10 Multicast network software design TASHKENT UNIVERSITY OF INFORMATION TECHNOLOGIES THE DEPARTMENT OF DATA COMMUNICATION.
NETWORK PROGRAMMING.
1 Chapter 4 IP Addressing : Classful Addressing Chapter 4 IP Addressing : Classful Addressing Mi-Jung Choi Dept. of Computer Science, KUN
Networks Sockets and Streams. TCP/IP in action server ports …65535 lower port numbers ( ) are reserved port echo7 time13 ftp20 telnet23.
Java IO. Why IO ? Without I/O, your program is a closed box. Without I/O, your program is a closed box. I/O gives your Java program access to your hard.
By Vivek Dimri. Basic Concepts on Networking IP Address – Protocol – Ports – The Client/Server Paradigm – Sockets The Java Networking Package – The InetAddress.
Subnetting. Class A Address O is the subnet Identifier is the loop back address. 4 Each class A address supports 16,387,064 hosts. 4 Assigned.
MIDP Programming Networking. Chapter Objectives The CLDC Streams Model Generic Connection Framework (GCF) Supported Protocols Creating a Connection Review.
Prepared by Dr. Jiying Zhao University of Ottawa Canada.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
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.
1 Lecture, November 20, 2002 Message Delivery to Processes Internet Addressing Address resolution protocol (ARP) Dynamic host reconfiguration protocol.
Agenda Socket Programming The OSI reference Model The OSI protocol stack Sockets Ports Java classes for sockets Input stream and.
Network Programming. These days almost all devices.
Networking for Home and Small Businesses – Chapter 5
Source: Java Sockets Source:
Network Programming Introduction
Block 14 Group Communication (Multicast)
Networking with Java 2.
An Introduction to TCP/IP and Sockets
PRESENTED To: Sir Abid………. PRESENTED BY: Insharah khan………. SUBJECT:
Network Programming Introduction
Sockets and URLs 17-Sep-18.
Sockets and URLs 13-Nov-18.
URL in Java C343 Lab (Week 13).
Networking.
Review of TCP/IP Internetworking
Sockets and URLs 3-Dec-18.
INTERNET PROTOCOL Presented by: Md:Faruque-A-Azam ID:1642CSE00570 Batch:42 CSE,MIU.
Connecting to the Network
Networking for Home and Small Businesses – Chapter 5
Server-Client communication without connection
Server-Client communication without connection
16EC Computer networks unit II Mr.M.Jagadesh
Presentation transcript:

자바네트워크 제 13 주 URLConnection 클래스 IP 멀티캐스팅 소켓

여러분들의 질문 지난 주 실습 내용 질문

토론을 위한 질문

책 읽기 질문

단어 퀴즈

다음주 과제 Java NIO 및 채널과 셀렉터 공부해오기

제 12 장 URLConnection 클래스 URLConnection 객체 생성 URLConnection 클래스의 메소드 기타 메소드들

URLConnection 객체 생성 URLConnection 클래스는 추상 클래스이다. URL 클래스의 openConnection() 메소드로 URLConnection 객 체를 얻는다.

예제

URLConnection 클래스 메소드 헤더의 구문 분석 메소드들 서버로부터 데이터를 가져오는 메소드들 URLConnection 의 환경 설정 메소드 기타 메소드들

헤더의 구문 분석 메소드들 MIME(Multipurpose Internet Mail Extension) 타입 : RFCs 2045, 2046, 2047, 2049, 4288, 4289 일반유형 / 세부유형 : text/html, text/plain, image/gif, image/jpeg, video/mpeg, application/octet-stream, … public String getContentType(), null when no data public int getContentLength(), -1 when no data public String getContentEncoding(), null when no encoding, usually base64 or quoted printable public long getDate(), 전송된 날짜 public long getExpiration(), 캐시에서 없어지는 날짜 public long getLastModified(), 최종수정된 날짜

서버로부터 데이터를 가져오 는 메소드들 public InputStream getInputStream(), public OutputStream getOutputStream(), use setDoOutput(true) before using this method public Object getContent() throws IOException, currently available types, text/plain, image/gif, image/jpeg

URLConnection 의 환경 설정 메소드 URLConnection 은 setup 상태와 connected 상태를 갖는다. 기 본은 setup 상태이다. 환경 설정은 setup 상태에서 한다. connected 상태로의 전환은 connect() 또는 헤더 또는 데이 터를 읽는 함수 실행이 자동으로 발생한다. public void setDoInput(boolean doinput), 자료를 읽을 수 있 도록 설정 (true)/ 해제 (false) 한다. public void setDoOutput(boolean dooutput), 자료를 쓸 수 있 도록 설정 (true)/ 해제 (false) 한다. public boolean getDoInput() public boolean getDoOutput() setup 상태가 아니면 IllegalAccess 오류 발생

URLConnection 의 환경 설정 메소드 public void setRequestProperty(String key, String value) public String getRequestProperty(String key) public void setUseCaches(boolean usecaches) public boolean getUseCaches() public void setAllowUserInteraction() public boolean getUserInteraction() public void setIfModifiedSince(long timemillis), 주어진 시간 이후에 수정된 파일만 읽도록 설정 public long getIfModifiedSince() public URL getURL() public abstract void connect() throws IOException, 호스트와 명시적으로 연결 설정

기타 메소드들 public String getHeaderField(String name), null if not exist public int getHeaderFieldInt(String name, int default), return default if not possible public long getHeaderFieldDate(String name, long default) public String getHeaderField(int n), n 번째 key-value 쌍의 value 를 반환 public String getHeaderFieldKey(int n), n 번 째 key-value 쌍의 key 값을 반환 protected static String guessContentTypeFromName(String name) protected static String guessContentTypeFromStream(InputStream is)

제 13 장 IP 멀티캐스팅 소켓 Multicast( 멀티캐스트 ) MulticastSocket 클래스 멀티캐스트 패킷 수신 멀티캐스트 패킷 송신

Introduction Unicast : one-to-one communication Multicast : one-to-many communication Need to multicast function for Router

What Is a Multicast Socket? Broadcast : send to all internet connected hosts Unicast : transmission is the sending of messages to a single network destination host on a packet switching network Multicast : sends data only to interested destinations by using special address assignments

Broadcast

Multicast

Unicast

Anycast

Geocast

Multicast vs Unicast

Multicast vs Broadcast

TTL(Time to live) Maximum number of routers to pass

IP, UDP header UDP Datagram

Multicast address and group ~ : D class Each host can join freely

Client and Server Multicast uses UDP Use MulticastDatagram TTL values 0: local host 1: local subnet 16: local campus 32: high band sites in the nation 48: all host in a nation 64: all host in the same continent 128: high band sites in the world 256: all sites in the world

Router and Routing Internet

Working with Multicast Sockets MulticastSocket class Join multicast group: joinGroup()

Two Simple Examples MulticastSniffer

MulticastSender Router do not support Multicast