1 / 36

The Internet and Java Sockets

ICW Lecture 5 Tom Chothia. The Internet and Java Sockets. Reminder of Last Time:. Encryption can be public key or symmetric. Use a Cipher Object in Java to encrypt and decrypt. Keep your keys in a KeyStore. This Time:. How the Internet works. Some History TCP/IP DNS

jamel
Download Presentation

The Internet and Java Sockets

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ICW Lecture 5 Tom Chothia The Internet and Java Sockets

  2. Reminder of Last Time: • Encryption can be public key or symmetric. • Use a Cipher Object in Java to encrypt and decrypt. • Keep your keys in a KeyStore

  3. This Time: • How the Internet works. • Some History • TCP/IP • DNS • How to make socket connections between computers using Java. • How to send Strings and Objects.

  4. Before the Internet • Life was solitary, poor, nasty, brutish and short. • Computer Networks: • local networks, • telephone line connections, • leased line.

  5. The Start 1969 • The US Defense Advanced Research Projects Agency (then ARPA now DARPA) gives research grants to universities to buy computers. • The decide to link their computers. • But how?

  6. The Problem With Leased Lines A C B D

  7. The Problem With Leased Lines A C B D

  8. If A and D use the line, then C and B can't A C B D

  9. But if everyone just sends a small packet of data, they can both use the line at the same. A C B D

  10. The Internet Protocol Packet

  11. IP Addresses • Every computer has an IP address. e.g. 147.188.193.15 • Every router on the Internet keeps a list of which connection it should use for which addresses.

  12. Transmission Control Protocol • 1974: daily traffic more than 3 million packets a day. Many are getting lost. • TCP is a protocol than runs on top on IP, if an IP packet gets lost. It requests that it is resent. • TCP/IP becomes allows Inter network connections. So in 1977:

  13. The ARPAnet • 1969 the birth of the ARPAnet. • 1971 E-mail @ • 1977 the ARPAnet becomes a Inter-network. • 1978 first Spam message send. Admin assures users this will never happen again

  14. The Internet • 1982 :-) • 1983 TCP/IP becomes standard. • By 1990 most of Europe, India and South Africa have joined.

  15. Domain Name Servers (DNS) • Remembering IP address is to hard. • So people associate names with addresses. e.g. news.bbc.com → 212.58.226.141 • A hierarchy of servers list handle requests • The route for most of Europe is RIPE based in Amsterdam.

  16. The Internet • 1988 The Morris Worm, CERT formed. • 1989 The Web: HTTP and HTML. • 1992 The first ISPs and Mosaic the first web browser. • 1994 Yahoo

  17. Today • All computers on the Internet have an IP address. • Key Internet Protocols: TCP/IP • DNS to turn names into numbers.

  18. The Internet Protocol Stack Application Internet communication uses a stack of protocols. Each protocol uses the protocol below it to sent data. Transport Network Link/Hardware

  19. Using the Stack to Send Data Computer 2 Computer 1 Application Application Data Data Transport Transport HT(Data) HT(Data) HT(Da) Network Network HN(HT(Da) HN(HT(Da) HN(HT(ta)) HLHN(HT(ta)) Link/Hardware Link/Hardware HLHN(HT(Da) ), HLHN(HT(ta)) Lost HLHN(HT(Da), HLHN(HT(ta))

  20. The Stack, Most of the Time: Stuff that you write Application TCP or UDP Transport Network IP Link/Hardware Ethernet or 802.11

  21. Sockets • A computer is Identified by an IP address. • To allow multiple connections each computer has a port number. • WWW runs on port 80, ssh on port 22, dns on 53, (free wifi). • A simple connection between two computers is called a socket. • Sockets are uniquely identified by (IP sender, port sender,IP receiver,port receiver).

  22. Our View of the Stack in Java Application Java Program Sockets

  23. Sockets in Java • Use java.io.Socket to make a socket that connects to a remote computer. • Use java.io.ServerSocket to make a socket that listens for an incoming connection. • Sockets just give bytes, so then need a wrapper.

  24. Code Demo • Simple socket connections

  25. Multi-Threaded Servers • To receive multiple connections you can use threads. • See demo. • More on Threads in Lecture 11.

  26. Sending an Object • Java lets you send an object over a socket. • The Object must be Serializable and have a UID (see demo). • Use the ObjectStream wrapper to send Objects.

  27. Conclusion • The Internet uses a packet based routing system IP. • Sockets are an easy way to connect between machines. • Use the Socket and ServerSocket Class. • Use a wrapper for the socket for different data types.

  28. Next Time: • All the data send was total insecure. • Next lecture I will show you how • how to make encrypted sockets, • how to know who your talking to. • i.e. what exactly does the little padlock main in my web browser?

More Related