Java Network Programming, Part 1: URLs, URLConnections, and InetAddresses, Sockets, Server Sockets, and UDP
http://www.cafeaulait.org/slides/sd2000east/urls/
Java Network Programming, Part 1: URLs, URLConnections, and InetAddresses
- Please turn off all
- We will learn how Java handles
- I assume you
- Applet Network Security Restrictions
- Some Background
- Hosts
- Internet addresses
- Domain Name System (DNS)
- The InetAddress Class
- Creating InetAddresses
- The getByName() factory method
- Other ways to create InetAddress objects
- Getter Methods
- Utility Methods
- Ports
- Protocols
- IETF RFCs
- W3C Standards
- W3C Standards
- URLs
- Example URLs
- The Pieces of a URL
- The java.net.URL class
- Content and Protocol Handlers
- Finding Protocol Handlers
- Supported Protocols
- URL Constructors
- Constructing URL Objects
- Constructing URL Objects in Pieces
- Including the Port
- Relative URLs
- Constructing Relative URLs
- Parsing URLs
- For example,
- Parsing URLs
- Missing Pieces
- Reading Data from a URL
- Webcat
- The Bug in readLine()
- Webcat
- CGI
- Normal web surfing uses these two steps:
- Forms
- CGI
- GET and POST
- HTTP
- A Typical HTTP Connection
- What the client sends to the server
- MIME
- Browser Request MIME Header
- Server Response MIME Header
- Query Strings
- URL Encoding
- For example,
- The URLEncoder class
- For example,
- Example
- The URLDecoder class
- GET URLs
- URLConnections
- URLConnections vs. URLs
- URLConnection six steps:
- I/O Across a URLConnection
- For example,
- Reading Header Data
- getHeaderFieldKey()
- For example
- getHeaderFieldInt() and getHeaderFieldDate()
- Example
- Six Convenience Methods
- Example
- Writing data to a URLConnection
- Eight Steps:
- POST CGIs
- A POST request includes
- Example
- Details
- HttpURLConnection
- Recall
- Response Codes
- HTTP Protocols
- getRequestMethod()
- disconnect()
- For example,
- usingProxy
- Redirect Instructions
- Example
- Example
- Following Redirects
- To Learn More
- Questions?
Java Network Programming, Part 2: Sockets, Server Sockets, and UDP
- Java Network Programming, Part 2: Sockets, Server Sockets, and UDP
- Please turn off all
- We will learn how Java handles
- I assume you
- Applet Network Security Restrictions
- Datagrams
- Packets Allow Error Correction
- Abstraction
- Sockets
- Socket Operations
- The java.net.Socket class
- Constructing a Socket
- Opening Sockets
- Example
- Example
- Picking an IP address
- Choosing a Local Port
- Sending and Receiving Data
- Reading Input from a Socket
- Time Client
- Writing Output to a Socket
- Discard
- Reading and Writing to a Socket
- Example
- Example
- Example
- Example
- Better Example
- Socket Options
- Example
- Servers
- Server Sockets
- Multiple Clients
- Queueing
- The java.net.ServerSocket Class
- Constructors
- Constructing Server Sockets
- Example
- Example
- Expanding the Queue
- Choosing an IP address
- Example
- Example
- Example
- Reading Data with a ServerSocket
- Example
- Better Example
- Writing Data to a Client
- Interacting with a Client
- Threading
- Adding Threading to a Server
- Adding a Thread Pool to a Server
- Example
- Thread Pools
- Setting Server Socket Options
- Utility Methods
- UDP
- The UDP Classes
- java.net.DatagramPacket
- java.net.DatagramSocket
- UDP ports
- Two DatagramPacket Constructors
- For example,
- With a destination:
- DatagramPackets are not immutable.
- java.net.DatagramSocket
- Sending UDP Datagrams
- For example,
- Receiving UDP Datagrams
- For example,
- To Learn More
- Questions?
Comments
Post a Comment