SlideServe
Menu
Préférences
© SlideServe · v2026

Java Socket Programming: Connecting People over the Interweb

rachaelleslie avatar
10 diapositives · 179 Views · Jan 06, 2020

Learn how to create network applications using Java socket programming at different layers of the internet, from basic connections to advanced communication protocols.

Java Socket Programming: Connecting People over the Interweb - slide 1
01 / 10Java Socket Programming: Connecting People over the Interweb
1 / 17

Télécharger la présentation

Java Socket Programming: Connecting People over the Interweb
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Networking with Java Socket programming

  2. The Interweb thing Al Gore invented… • Internet is a network of networks. • The Internet is really people communicating. • Application layers 7, 6 : • email, HTTP, FTP, Telnet, file 'sharing', streaming media, VoIP • remote access: VPN • Session layer 5: connections. e.g. sockets • Transport layer 4: TCP, UDP • Network layer 3: IP, the Internet • Link layer 2, 1: NICs, device drivers, magic.

  3. Internet traffic • 10% YouTube HTTP • 36% other HTTP • 37% P2P • 17% newsgroups, streaming, gaming, VoIP • In other words, mostly a waste of bits.

  4. Internet…what's it good for? • For years there has been a theory that millions of monkeys typing at random on millions of typewriters would reproduce the entire works of Shakespeare… The Internet has proven this theory to be untrue. - Anonymous

  5. Socket Programming If a packet hits a pocket on a socket on a port, and the bus is interrupted as a very last resort, and the address of the memory makes your floppy disk abort, then the socket packet pocket has an error to report! fromA Grandchild's Guide to Using Grandpa's Computer by Gene Ziegler

  6. Sockets programming • a client exchanging data with a server • An Internetsocket is composed of the following: • Protocol (TCP, UDP, raw IP) • Local IP address (your computer) • Local port (your application) • Remote IP address (another computer) • Remote port (another application)

  7. Server Sockets in Java • package java.net • ServerSocketserver = new ServerSocket(PORT); // waits for network requests. • Socket socket = server.accept();// waits for a connection and returns a socket • use java.io to exchange data • InputStream from socket (client) • OutputStream to socket (client)

  8. Client Sockets in Java • package java.net • Socketsocket = new Socket ( host, port); // waits for a connection to host on a port and returns a socket • use java.io to exchange data • InputStream from socket (server) • OutputStream to socket (server) • see PortScanner.java

  9. URL and IP addresses • URL class represents aUniform Resource Locator, a pointer to a "resource" on the World Wide Web. • see ReadURL.java • InetAddress class represents an Internet Protocol (IP) address. • used to find out who the socket is talking to. • ServerSocket or Socket can .getInetAddress();

  10. Sockets Programming see • EchoServer.java & EchoClient.java • simple two-way communication • EchoServerThread.java & EchoClient.java • multi-threaded server to handle many sets oftwo-way communication