URL Kullanımı Get URL
|
|
- Lily Gibson
- 6 years ago
- Views:
Transcription
1 Networking 1
2 URL Kullanımı Get URL URL info 2
3 import java.io.*; import java.net.*; public class GetURL { public static void main(string[] args) { InputStream in = null; OutputStream out = null; // Check the arguments if ((args.length!= 1) && (args.length!= 2)) throw new IllegalArgumentException("Wrong number of arguments"); URL url = new URL(args[0]); // Create the URL in = url.openstream(); // Open a stream to it if (args.length == 2) // Get an appropriate output stream out = new FileOutputStream(args[1]); else out = System.out; byte[] buffer = new byte[4096]; int bytes_read; while((bytes_read = in.read(buffer))!= 1) out.write(buffer, 0, bytes_read); catch (Exception e) { System.err.println(e); System.err.println("Usage: java GetURL <URL> [<filename>]"); finally { // Always close the streams, no matter what. in.close(); out.close(); catch (Exception e) { 3
4 import java.net.*; import java.io.*; import java.util.date; public class GetURLInfo { public static void printinfo(url url) throws IOException { URLConnection c = url.openconnection(); // Get URLConnection from the URL c.connect(); // Open a connection to the URL System.out.println(" Content Type: " + c.getcontenttype()); System.out.println(" Content Encoding: " + c.getcontentencoding()); System.out.println(" Content Length: " + c.getcontentlength()); g System.out.println(" Date: " + new Date(c.getDate())); System.out.println(" Last Modified: " + new Date(c.getLastModified())); System.out.println(" Expiration: " + new Date(c.getExpiration())); if (c instanceof HttpURLConnection) { HttpURLConnection h = (HttpURLConnection) c; System.out.println(" Request Method: " + h.getrequestmethod()); System.out.println(" Response Message: " + h.getresponsemessage()); g System.out.println(" Response Code: " + h.getresponsecode()); information about it. */ public static void main(string[] args) { printinfo(new URL(args[0])); catch (Exception e) { System.err.println(e); System.err.println("Usage: java GetURLInfo <url>"); 4
5 E posta Gönderme 5
6 import java.io.*; import java.net.*; public class SendMail { public static void main(string[] args) { if (args.length >= 1) System.getProperties().put("mail.host", args[0]); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("From: "); String from = in.readline(); System.out.print("To: "); String to = in.readline(); System.out.print("Subject: "); String subject = in.readline(); URL u = new URL("mailto:" + to); // Create a mailto: URL URLConnection c = u.openconnection(); // Create a URLConnection for it c.setdoinput(false); // Specify no input from this URL c.setdooutput(true); // Specify we'll do output System.out.println("Connecting..."); // Tell the user what's happening System.out.flush(); // Tell them right now c.connect(); // Connect to mail host PrintWriter out = // Get output stream to mail host new PrintWriter(new OutputStreamWriter(c.getOutputStream())); 6
7 out.println("from: \"" + from + "\" <" + System.getProperty("user.name") + "@" + InetAddress.getLocalHost().getHostName() + ">"); out.println("to: " + to); out.println("subject: " + subject); out.println(); // blank line to end the list of headers System.out.println("Enter the message. " + "End with a '.' on a line by itself."); String line; for(;;) { line = in.readline(); if ((line == null) line.equals(".")) break; out.println(line); out.close(); System.out.println("Message sent."); System.out.flush(); catch (Exception e) { // Handle any exceptions, print error message. System.err.println(e); System.err.println("Usage: java SendMail [<mailhost>]"); 7
8 Web Server a bağlanma 8
9 import java.io.*; import java.net.*; public class HttpClient { public static void main(string[] args) { if ((args.length!= 1) && (args.length!= 2)) throw new IllegalArgumentException("Wrong number of arguments"); OutputStream to_file; if (args.length == 2) to_file = new FileOutputStream(args[1]); else to_file = System.out; URL url = new URL(args[0]); String protocol = url.getprotocol(); if (!protocol.equals("http")) throw new IllegalArgumentException("URL must use ' protocol"); String host = url.gethost(); t() int port = url.getport(); if (port == 1) port = 80; // if no port, use the default HTTP port String filename = url.getfile(); Socket socket = new Socket(host, port); InputStream from_server = socket.getinputstream(); Pi PrintWriter twit to_server = new PrintWriter(new OutputStreamWriter(socket.getOutputStream())); 9
10 to_server.println("get " + filename); to_server.flush(); // Send it right now! byte[] buffer = new byte[4096]; int bytes_read; while((bytes_read = from_server.read(buffer))!= 1)) to_file.write(buffer, 0, bytes_read); socket.close(); to_file.close(); catch (Exception e) { // Report any errors that arise System.err.println(e); System.err.println("Usage: java HttpClient <URL> [<filename>]"); 10
11 import java.io.*; import java.net.*; public class HttpMirror { public static void main(string args[]) { int port = Integer.parseInt(args[0]); ServerSocket ss = new ServerSocket(port); for(;;) { Socket client = ss.accept(); BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream())); PrintWriter out = new PrintWriter(new OutputStreamWriter(client.getOutputStream())); out.println("http/ "); // Version & status code out.println("content Type: text/plain"); // The type of data we send out.println(); // End of response headers out.flush(); String line; while((line = in.readline())!= null) { if (line.length() == 0) break; out.println(line); out.close(); in.close(); client.close(); close(); // Loop again, waiting for the next connection catch (Exception e) { System.err.println(e); err System.err.println("Usage: java HttpMirror <port>"); 11
12 SimpleProxyServer.java import java.io.*; import java.net.*; public class SimpleProxyServer { public static void main(string[] args) throws IOException { if (args.length!= 3) throw new IllegalArgumentException("Wrong number of arguments."); String host = args[0]; int remoteport = Integer.parseInt(args[1]); int localport = Integer.parseInt(args[2]); System.out.println( println("starting proxy for " + host + ":" + remoteport + " on port " + localport); runserver(host, remoteport, localport); // never returns catch (Exception e) { System.err.println(e); System.err.println("Usage: java SimpleProxyServer " + "<host> <remoteport> <localport>"); 12
13 public static void runserver(string host, int remoteport, int localport) throws IOException { ServerSocket ss = new ServerSocket(localport); final byte[] request = new byte[1024]; byte[] reply = new byte[4096]; while(true) { Socket client = null, server = null; client = ss.accept(); final InputStream from_client = client.getinputstream(); final OutputStream to_client= client.getoutputstream(); server = new Socket(host, remoteport); catch (IOException e) { PrintWriter out = new PrintWriter(new OutputStreamWriter(to_client)); out.println( println("proxy server cannot connect to " + host + ":" + remoteport + ":\n" + e); out.flush(); client.close(); continue; 13
14 final InputStream from_server = server.getinputstream(); final OutputStream to_server = server.getoutputstream(); Thread t = new Thread() { public void run() { int bytes_read; while((bytes_read = from_client.read(request))!= 1) { to_server.write(request, 0, bytes_read); to_server.flush(); catch (IOException e) { to_server.close(); catch (IOException e) { ; t.start(); intbytes _ read; while((bytes_read = from_server.read(reply))!= 1) { to_client.write(reply, 0, bytes_read); to_client.flush(); catch(ioexception e) { to_client.close(); catch (IOException e) { System.err.println(e); finally { if (server!= null) server.close(); if (client!= null) client.close(); catch(ioexception e) { 14
15 import java.applet.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.net.*; public class Who extends Applet implements ActionListener, Runnable { Button who; // The button in the applet public void init() { who = new Button("Who?"); who.setfont(new Font("SansSerif", Font.PLAIN, 14)); who.addactionlistener(this); who.setactioncommand("who"); this.add(who); public void actionperformed(actionevent e) { if (e.getactioncommand().equals("who")) new Thread(this).start(); public void run() { who.setenabled(false); Frame f = new CloseableFrame("Who's Logged On: Connecting..."); TextArea t = new TextArea(10, 80); t.setfont(new Font("MonoSpaced", Font.PLAIN, 10)); f.add(t, "Center"); f.pack(); f.show(); 15
16 Socket s = null; PrintWriter out = null; BufferedReader in = null; String hostname = this.getcodebase().gethost(); s = new Socket(hostname, 79); out = new PrintWriter(new OutputStreamWriter(s.getOutputStream())); in = new BufferedReader(new InputStreamReader(s.getInputStream())); out.println(); out.flush(); // Send it now! String line; while((line = in.readline())!= null) { t.append(line); t.append("\n"); f.settitle("who's Logged On: " + hostname); catch (IOException e) { t.append(e.tostring()); f.settitle("who's Logged On: Error"); finally { in.close(); out.close(); s.close(); catch(exception e){ who.setenabled(true); 16
public static void main(string[] args) throws IOException { sock = new Socket(args[0], Integer.parseInt(args[1]));
Echo Client&Server Application EchoClient import java.net.*; import java.io.*; class EchoClient public static void main(string[] args) throws IOException if (args.length < 2) number>"); System.err.println("Usage:
More informationCOMP 213. Advanced Object-oriented Programming. Lecture 20. Network Programming
COMP 213 Advanced Object-oriented Programming Lecture 20 Network Programming Network Programming A network consists of several computers connected so that data can be sent from one to another. Network
More informationCS2307 NETWORKS LAB 1. Programs using TCP Sockets (like date and time server & client, echo server & client, etc.) 2. Programs using UDP Sockets
CS2307 NETWORKS LAB 1. Programs using TCP Sockets (like date and time server & client, echo server & client, etc.) 2. Programs using UDP Sockets (like simple DNS) 3. Programs using Raw sockets (like packet
More informationNetwork. Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark
Network Dr. Jens Bennedsen, Aarhus University, School of Engineering Aarhus, Denmark jbb@ase.au.dk Outline Socket programming If we have the time: Remote method invocation (RMI) 2 Socket Programming Sockets
More informationNetworking Basics. network communication.
JAVA NETWORKING API Networking Basics When you write Java programs that communicate over the network, you are programming at the application layer. Typically, you don't need to concern yourself with the
More informationPrevious lecture: threads G51PRG: Introduction to Programming Second semester Lecture 12 URL
Previous lecture: threads G51PRG: Introduction to Programming Second semester Lecture 12 What is a thread Why use multiple threads Issues and problems involved Java threads Natasha Alechina School of Computer
More informationTCP connections. Fundamentals of Internet Connections Objectives. Connect to an Echo port. java.net.socket
Objectives TCP connections To understand programming of clients that connect to servers via TCP To understand the basics of programming of servers that accept TCP connections To practice programming of
More informationNetwork Programming. Powered by Pentalog. by Vlad Costel Ungureanu for Learn Stuff
Network Programming by Vlad Costel Ungureanu for Learn Stuff Java Network Protocols 2 Java Network Protocols 3 Addresses Innet4Address (32-bit) 85.122.23.145 - numeric pentalog.com symbolic Innet6Address
More informationDistributed Systems COMP 212. Lecture 8 Othon Michail
Distributed Systems COMP 212 Lecture 8 Othon Michail HTTP Protocol Hypertext Transfer Protocol Used to transmit resources on the WWW HTML files, image files, query results, Identified by Uniform Resource
More informationSockets and RMI. CS151 Chris Pollett Dec. 5, 2005.
Sockets and RMI CS151 Chris Pollett Dec. 5, 2005. Outline Echo Server with Multiple Clients Client pull/server push Remote Method Invocation Proxy Pattern Echo Server with Multiple Clients public class
More informationCPSC 441 Tutorial TCP Server. Department of Computer Science University of Calgary
CPSC 441 Tutorial TCP Server Department of Computer Science University of Calgary TCP Socket Client Server Connection Request Server Listening on welcoming socket Client Socket Server Socket Data Simple
More informationReading from URL. Intent - open URL get an input stream on the connection, and read from the input stream.
Simple Networking Loading applets from the network. Applets are referenced in a HTML file. Java programs can use URLs to connect to and retrieve information over the network. Uniform Resource Locator (URL)
More informationCS September 2017
Machine vs. transport endpoints IP is a network layer protocol: packets address only the machine IP header identifies source IP address, destination IP address Distributed Systems 01r. Sockets Programming
More informationJAVA - NETWORKING (SOCKET PROGRAMMING)
JAVA - NETWORKING (SOCKET PROGRAMMING) http://www.tutorialspoint.com/java/java_networking.htm Copyright tutorialspoint.com The term network programming refers to writing programs that execute across multiple
More informationObject-Oriented Programming in Java
CSCI/CMPE 3326 Object-Oriented Programming in Java 1. Socket Programming Dongchul Kim Department of Computer Science University of Texas Rio Grande Valley Two types of TCP Socket java.net.serversocket
More informationLecture 3: Socket Programming
Lecture 3: Socket Programming Prof. Shervin Shirmohammadi SITE, University of Ottawa Fall 2005 CEG4183/ELG4183 3-1 Sockets From a logical perspective, a Socket is a communication end point. It is not a
More informationSteps for Implementing a Server
Agenda 5 Steps for creating a server 1. Create a ServerSocket object 2. Create a Socket object from ServerSocket 3. Create an input stream 4. Create an output stream 5. Do I/O with input and output streams
More informationNetworking Code CSCI 201 Principles of Software Development
Networking Code CSCI 201 Principles of Software Development Jeffrey Miller, Ph.D. jeffrey.miller@usc.edu Server Networking Client Networking Program Outline USC CSCI 201L Server Software A server application
More informationNetwork Programming: Servers
2012 Marty Hall Network Programming: Servers Originals of Slides and Source Code for Examples: http://courses.coreservlets.com/course-materials/java.html 3 Customized Java EE Training: http://courses.coreservlets.com/
More informationInput from Files. Buffered Reader
Input from Files Buffered Reader Input from files is always text. You can convert it to ints using Integer.parseInt() We use BufferedReaders to minimize the number of reads to the file. The Buffer reads
More informationIT101. File Input and Output
IT101 File Input and Output IO Streams A stream is a communication channel that a program has with the outside world. It is used to transfer data items in succession. An Input/Output (I/O) Stream represents
More informationJava.net Package and Classes(Url, UrlConnection, HttpUrlConnection)
Java.net Package and Classes(Url, UrlConnection, HttpUrlConnection) Sisoft Technologies Pvt Ltd SRC E7, Shipra Riviera Bazar, Gyan Khand-3, Indirapuram, Ghaziabad Website: www.sisoft.in Email:info@sisoft.in
More informationJava for Interfaces and Networks
Java for Interfaces and Networks Threads and Networking Federico Pecora School of Science and Technology Örebro University federico.pecora@oru.se Federico Pecora Java for Interfaces and Networks Lecture
More informationJAVA 프로그래밍 II. Lab #7 (Networking) TCP Java Socket. TCP vs UDP 2017 학년도 1 학기 년봄학기 5/24/2017 박경신. Client. Server
Lab #7 (Networking) 2017 학년도 1 학기 JAVA 프로그래밍 II 기존요구사항분석 Lab #6 는 Thread, Runnable 과 SwingWorker 를이용한다양한멀티스레드기능을사용 Lab #7 는 TCP/UDP 등다양한네트워크프로그래밍기능을사용 TCP, UDP, HTTP, File Transfer 514770-1 2017 년봄학기 5/24/2017
More informationLab 1 : Java Sockets
Lab 1 : Java Sockets 1. Goals In this lab you will work with a low-level mechanism for distributed communication. You will discover that Java sockets do not provide: - location transparency - naming transparency
More informationTCP and UDP Socket Programming in JAVA TCP Socket Programming 1. Write code for Client and save in GreetingClient.java
TCP Socket Programming 1. Write code for Client and save in GreetingClient.java // File Name GreetingClient.java public class GreetingClient public static void main(string [] args) String servername =
More informationJava Technologies. Lecture VII. Valdas Rapševičius. Vilnius University Faculty of Mathematics and Informatics
Preparation of the material was supported by the project Increasing Internationality in Study Programs of the Department of Computer Science II, project number VP1 2.2 ŠMM-07-K-02-070, funded by The European
More informationCS193j, Stanford Handout #26. Files and Streams
CS193j, Stanford Handout #26 Summer, 2003 Manu Kumar Files and Streams File The File class represents a file or directory in the file system. It provides platform independent ways to test file attributes,
More informationA socket is a software endpoint that establishes bidirectional communication between a server program and one or more client programs.
PART 24 Java Network Applications 24.1 Java Socket Programming A socket is a software endpoint that establishes bidirectional communication between a server program and one or more client programs. A server
More informationCS 2113 Software Engineering
CS 2113 Software Engineering Java 6: File and Network IO https://github.com/cs2113f18/template-j-6-io.git Professor Tim Wood - The George Washington University Project 2 Zombies Basic GUI interactions
More informationJava for Interfaces and Networks (DT3029)
Java for Interfaces and Networks (DT3029) Lecture 3 Threads and Networking Federico Pecora federico.pecora@oru.se Center for Applied Autonomous Sensor Systems (AASS) Örebro University, Sweden Capiscum
More informationJava Networking (sockets)
Java Networking (sockets) Rui Moreira Links: http://java.sun.com/docs/books/tutorial/networking/toc.html#sockets http://www.javaworld.com/javaworld/jw-12-1996/jw-12-sockets_p.html Networking Computers
More informationJava Development: Do s and Don ts
Java Development: Do s and Don ts 1 Overview Asynchronous networking Data copies Connection management Logging 2 ASL Project 2016: Middleware for different replication modes Middleware op SET/DEL GET Memcached
More informationMulti-threaded Web Server (Assignment 1) Georgios Georgiadis
Multi-threaded Web Server (Assignment 1) Georgios Georgiadis Overview Multi-threaded Web Server What to do and how to do it HTTP messages Processes and threads ComputerComm '09 2 Multi-threaded Web Server
More informationCSPP : Introduction to Object-Oriented Programming
CSPP 511-01: Introduction to Object-Oriented Programming Harri Hakula Ryerson 256, tel. 773-702-8584 hhakula@cs.uchicago.edu August 7, 2000 CSPP 511-01: Lecture 15, August 7, 2000 1 Exceptions Files: Text
More informationIntroduction to Sockets
Introduction to Sockets Sockets in Java 07/02/2012 EPL 602 1 Socket programming Goal: learn how to build client/server application that communicate using sockets Socket API o introduced in BSD4.1 UNIX,
More informationInternet Technology 2/7/2013
Sample Client-Server Program Internet Technology 02r. Programming with Sockets Paul Krzyzanowski Rutgers University Spring 2013 To illustrate programming with TCP/IP sockets, we ll write a small client-server
More information09-1. CSE 143 Java GREAT IDEAS IN COMPUTER SCIENCE. Overview. Data Representation. Representation of Primitive Java Types. Input and Output.
CSE 143 Java Streams Reading: 19.1, Appendix A.2 GREAT IDEAS IN COMPUTER SCIENCE REPRESENTATION VS. RENDERING 4/28/2002 (c) University of Washington 09-1 4/28/2002 (c) University of Washington 09-2 Topics
More informationWeek 12. Streams and File I/O. Overview of Streams and File I/O Text File I/O
Week 12 Streams and File I/O Overview of Streams and File I/O Text File I/O 1 I/O Overview I/O = Input/Output In this context it is input to and output from programs Input can be from keyboard or a file
More informationRequirements. PA4: Multi-thread File Downloader Page 1. Assignment
PA4: Multi-thread File Downloader Page 1 Assignment What to Submit Write a program that downloads a file from the Internet using multiple threads. The application has a Graphical Interface written in JavaFX,
More informationFile IO. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 20
File IO Computer Science and Engineering College of Engineering The Ohio State University Lecture 20 I/O Package Overview Package java.io Core concept: streams Ordered sequences of data that have a source
More informationI/O Streams. Object-oriented programming
I/O Streams Object-oriented programming Outline Concepts of Data Streams Streams and Files File class Text file Binary file (primitive data, object) Readings: GT, Ch. 12 I/O Streams 2 Data streams Ultimately,
More information830512@itri.org.tw import java.net.socket; import java.net.serversocket; import java.io.ioexception; /* ---------- Java Server ---------- */ public class Nets static Socket thesocket; static ServerThread
More informationConnecting to a Server Implementing Servers Making URL Connections Advanced Socket Programming
Course Name: Advanced Java Lecture 11 Topics to be covered Connecting to a Server Implementing Servers Making URL Connections Advanced Socket Programming Introduction Internet and WWW have emerged as global
More informationCSCD 330 Network Programming Spring 2018
CSCD 330 Network Programming Spring 2018 Lecture 7 Application Layer Socket Programming in Java Reading: Chapter 2, Java links Relevant Links page Some Material in these slides from J.F Kurose and K.W.
More informationJava in 21 minutes. Hello world. hello world. exceptions. basic data types. constructors. classes & objects I/O. program structure.
Java in 21 minutes hello world basic data types classes & objects program structure constructors garbage collection I/O exceptions Strings Hello world import java.io.*; public class hello { public static
More informationNetworking with java (socket programming) a brief study
REVIEWS COMPUTER ENGINEERING Discovery Engineering, Volume 2, Number 7, October 2013 ISSN 2320 6675 EISSN 2320 6853 Discovery Engineering REVIEWS COMPUTER ENGINEERING discovery Engineering Networking with
More informationPrinciples, Models, and Applications for Distributed Systems M
Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M Lab assignment 4 (worked-out) Connection-oriented Java Sockets Luca Foschini Winter
More informationNetwork Programming Benoît Garbinato
Network Programming Benoît Garbinato 1 Network programming Network programming is not distributed programming (somewhat lower-level) They both rely on: computers as processing & storage resources a network
More informationDistributed Programming
Distributed Programming Processes don t share memory. Processes share channels over which messages are passed Channels may be Global, receiver specific, or sender & receiver specific. One or two way. c
More informationByte and Character Streams. Reading and Writing Console input and output
Byte and Character Streams Reading and Writing Console input and output 1 I/O basics The io package supports Java s basic I/O (input/output) Java does provide strong, flexible support for I/O as it relates
More informationTechniques of Java Programming: Streams in Java
Techniques of Java Programming: Streams in Java Manuel Oriol May 8, 2006 1 Introduction Streams are a way of transferring and filtering information. Streams are directed pipes that transfer information
More informationCS 351 Design of Large Programs Sockets Example
CS 351 Design of Large Programs Sockets Example Brooke Chenoweth University of New Mexico Spring 2019 Socket Socket(String host, int port) InputStream getinputstream() OutputStream getoutputstream() void
More informationI gave this assignment in my Internet and Intranet Protocols and Applications course:
Producing Production Quality Software Lecture 1b: Examples of Bad Code Prof. Arthur P. Goldberg Fall, 2004 Summary I show some examples of bad code and discuss how they fail to meet the Software Quality
More informationCSCD 330 Network Programming Winter 2019
CSCD 330 Network Programming Winter 2019 Lecture 7 Application Layer Socket Programming in Java Reading: Chapter 2, Java links Relevant Links page Some Material in these slides from J.F Kurose and K.W.
More informationInternet and Intranet Applications and Protocols Examples of Bad SMTP Code Prof. Arthur P. Goldberg Spring, 2004
Internet and Intranet Applications and Protocols Examples of Bad SMTP Code Prof. Arthur P. Goldberg Spring, 00 Summary I show some examples of bad code and discuss how they fail to meet the Software Quality
More informationGetting started with Winstone. Minimal servlet container
Getting started with Winstone Minimal servlet container What is Winstone? Winstone is a small servlet container, consisting of a single JAR file. You can run Winstone on your computer using Java, and get
More information1.00 Lecture 30. Sending information to a Java program
1.00 Lecture 30 Input/Output Introduction to Streams Reading for next time: Big Java 15.5-15.7 Sending information to a Java program So far: use a GUI limited to specific interaction with user sometimes
More informationSpecial error return Constructors do not have a return value What if method uses the full range of the return type?
23 Error Handling Exit program (System.exit()) usually a bad idea Output an error message does not help to recover from the error Special error return Constructors do not have a return value What if method
More information} } class ClientHandler extends Thread { private Socket client; private Scanner input; private PrintWriter output;
import java.io.*; import java.net.*; import java.util.*; import java.util.properties; public class WebServer private static ServerSocket serversocket; private static final int PORT = 1234; public static
More informationDistributed Programming - Sockets
Distributed Programming - Sockets Piet van Oostrum May 25, 2009 Concurrency In praktische situaties krijgen we concurrency door: Processen Threads Interrupts (alleen intern in het O.S.) Processen Onafhankelijke
More information"protocol stack! chat. Java
"protocol stack! chat # # $ "! $ http://www.ietf.org/rfc.html http://www.skype.com$ Internet for dummies "' &! ("IP Address! %%() "port! * +%#%%() * * % * (I/O "streams! InputStreamReader in = new InputStreamReader(System.in);
More informationGetting Started in Java. Bill Pugh Dept. of Computer Science Univ. of Maryland, College Park
Getting Started in Java Bill Pugh Dept. of Computer Science Univ. of Maryland, College Park Hello, World In HelloWorld.java public class HelloWorld { public static void main(string [] args) { System.out.println(
More informationSERVER/CLIENT NETWORKING AT JAVA PLATFORM
SERVER/CLIENT NETWORKING AT JAVA PLATFORM Vibhu Chinmay, Shubham Sachdeva Student (B.tech5 th sem) Department of Electronics and Computers Engineering Dronacharya College of Engineering, Gurgaon-123506,
More informationPrinciples, Models, and Applications for Distributed Systems M
Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models, and Applications for Distributed Systems M Exercitation 3 Connected Java Sockets Jacopo De Benedetto Distributed architecture
More informationUnit 1 Java Networking
Q1. What is Server Socket? Discuss the difference between the Socket and ServerSocket class. The ServerSocket class (java.net) can be used to create a server socket. This object is used to establish communication
More informationPrinciples, Models and Applications for Distributed Systems M
Università degli Studi di Bologna Facoltà di Ingegneria Principles, Models and Applications for Distributed Systems M Lab assignment 2 (worked-out) Connectionless Java Sockets Luca Foschini 2010/2011 Exercise
More informationDM550 / DM857 Introduction to Programming. Peter Schneider-Kamp
DM550 / DM857 Introduction to Programming Peter Schneider-Kamp petersk@imada.sdu.dk http://imada.sdu.dk/~petersk/dm550/ http://imada.sdu.dk/~petersk/dm857/ IN & OUTPUT USING STREAMS 2 Streams streams are
More informationPrinciples of Software Construction. Introduction to networks and distributed systems School of Computer Science
Principles of Software Construction Introduction to networks and distributed systems Josh Bloch Charlie Garrod School of Computer Science 1 Administrivia Homework 5 Best Frameworks available tonight Or
More informationLecture 11.1 I/O Streams
21/04/2014 Ebtsam AbdelHakam 1 OBJECT ORIENTED PROGRAMMING Lecture 11.1 I/O Streams 21/04/2014 Ebtsam AbdelHakam 2 Outline I/O Basics Streams Reading characters and string 21/04/2014 Ebtsam AbdelHakam
More informationCSCD 330 Network Programming
CSCD 330 Network Programming Lecture 8 Client-Server Programming Threads Winter 2015 Reading: Chapter 2, Relevant Links Some Material in these slides from J.F Kurose and K.W. Ross All material copyright
More informationprotocols September 15,
Contents SCI 351 4 Protocols, WWW Internet applications WWW, document technology Lennart Herlaar Original slides by Piet van Oostrum September 15, 2003 SCI351-4 1 X SCI351-4 1 X Internet applications How
More informationProgram 20: //Design an Applet program to handle Mouse Events. import java.awt.*; import java.applet.*; import java.awt.event.*;
Program 20: //Design an Applet program to handle Mouse Events. import java.awt.*; import java.applet.*; import java.awt.event.*; /* */ public
More informationJava - Applications. The following code sets up an application with a drop down menu, as yet the menu does not do anything.
Java - Applications C&G Criteria: 5.3.2, 5.5.2, 5.5.3 Java applets require a web browser to run independently of the Java IDE. The Dos based console applications will run outside the IDE but have no access
More informationCOMP-202: Foundations of Programming. Lecture 12: Linked List, and File I/O Sandeep Manjanna, Summer 2015
COMP-202: Foundations of Programming Lecture 12: Linked List, and File I/O Sandeep Manjanna, Summer 2015 Announcements Assignment 4 is posted and Due on 29 th of June at 11:30 pm. Course Evaluations due
More informationDarshan Institute of Engineering & Technology for Diploma Studies
Streams A stream is a sequence of data. In Java a stream is composed of bytes. In java, 3 streams are created for us automatically. 1. System.out : standard output stream 2. System.in : standard input
More informationNetwork Programming java.net.inetaddress
Network Programming 605.481 1 java.net.inetaddress Utility object to resolve IP addresses to host names (and vice versa) No constructor use static methods Static methods InetAddress getlocalhost() throws
More informationCOMP-202: Foundations of Programming. Lecture 22: File I/O Jackie Cheung, Winter 2015
COMP-202: Foundations of Programming Lecture 22: File I/O Jackie Cheung, Winter 2015 Announcements Assignment 5 due Tue Mar 31 at 11:59pm Quiz 6 due Tue Apr 7 at 11:59pm 2 Review 1. What is a graph? How
More informationWriting a Protocol Handler
Writing a Protocol Handler A URL object uses a protocol handler to establish a connection with a server and perform whatever protocol is necessary to retrieve data. For example, an HTTP protocol handler
More informationTopic 10: Network Programming
Topic 10: Network Programming Client-Server Model Host and Port Socket Implementing Client Implementing Server Implementing Server for Multiple Clients Client-Server Model Clients Request a server to provide
More informationObject-Oriented Programming Design. Topic : Streams and Files
Electrical and Computer Engineering Object-Oriented Topic : Streams and Files Maj Joel Young Joel Young@afit.edu. 18-Sep-03 Maj Joel Young Java Input/Output Java implements input/output in terms of streams
More informationWeb Server Project. Tom Kelliher, CS points, due May 4, 2011
Web Server Project Tom Kelliher, CS 325 100 points, due May 4, 2011 Introduction (From Kurose & Ross, 4th ed.) In this project you will develop a Web server in two steps. In the end, you will have built
More informationOutlines. Networking in Java. Internet hardware structure. Networking Diagram. IP Address. Networking in Java. Networking basics
G52APR Application programming Networking in Java Michael Li http://www.cs.nott.ac.uk/~jwl/g52apr Outlines Networking basics Network architecture IP address and port Server-client model TCP and UDP protocol
More informationAdvanced Java Programming. Networking
Advanced Java Programming Networking Eran Werner and Ohad Barzilay Tel-Aviv University Advanced Java Programming, Spring 2006 1 Overview of networking Advanced Java Programming, Spring 2006 2 TCP/IP protocol
More informationChapter 2 Applications and
Chapter 2 Applications and Layered Architectures Sockets Socket API API (Application Programming Interface) Provides a standard set of functions that can be called by applications Berkeley UNIX Sockets
More informationProgrammierpraktikum
Programmierpraktikum Claudius Gros, SS2012 Institut für theoretische Physik Goethe-University Frankfurt a.m. 1 of 21 05/07/2012 10:31 AM Input / Output Streams 2 of 21 05/07/2012 10:31 AM Java I/O streams
More informationCONCURRENCY IN JAVA Course Parallel Computing
CONCURRENCY IN JAVA Course Parallel Computing Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Wolfgang.Schreiner@risc.jku.at http://www.risc.jku.at Java on a NUMA Architecture Loading
More informationCSCD 330 Network Programming
CSCD 330 Network Programming Lecture 8 Client-Server Programming Threads Spring 2018 Reading: Chapter 2, Relevant Links - Threads Some Material in these slides from J.F Kurose and K.W. Ross All material
More informationCPSC 441 Tutorial - 11 UDP Socket Programming Department of Computer Science University of Calgary
CPSC 441 Tutorial - 11 UDP Programming Department of Computer Science University of Calgary TCP Vs UDP Input: receives packet (TCP receives byte stream ) Output: sends packet (TCP sends byte stream ) What
More informationCSCD 330 Network Programming Spring 2018
CSCD 330 Network Programming Spring 2018 Lecture 6 Application Layer Socket Programming in Java Reading for Java Client/Server see Relevant Links Some Material in these slides from J.F Kurose and K.W.
More informationCS 355. Computer Networking. Wei Lu, Ph.D., P.Eng.
CS 355 Computer Networking Wei Lu, Ph.D., P.Eng. Chapter 2: Application Layer Overview: Principles of network applications? Introduction to Wireshark Web and HTTP FTP Electronic Mail: SMTP, POP3, IMAP
More informationToday. cisc3120-fall2012-parsons-lectiv.2 2
NETWORK PROGRAMMING Today Today we will start to look at ways to write programs that operate over the network. We ll lok at two approaches that are supported by Java: Applets Socket-based communication
More informationJava Support for developing TCP Network Based Programs
Java Support for developing TCP Network Based Programs 1 How to Write a Network Based Program (In Java) As mentioned, we will use the TCP Transport Protocol. To communicate over TCP, a client program and
More informationPART1: Choose the correct answer and write it on the answer sheet:
PART1: Choose the correct answer and write it on the answer sheet: (15 marks 20 minutes) 1. Which of the following is included in Java SDK? a. Java interpreter c. Java disassembler b. Java debugger d.
More information3. Remote Procedure Call
3. Remote Procedure Call Master II Software Engineering Imed Bouchrika Dept of Mathematics & Computer Science University of Souk-Ahras imed@imed.ws Imed Bouchrika. Distributed Objects, Uni of Souk-Ahras
More informationCOMP 213. Advanced Object-oriented Programming. Lecture 19. Input/Output
COMP 213 Advanced Object-oriented Programming Lecture 19 Input/Output Input and Output A program that read no input and produced no output would be a very uninteresting and useless thing. Forms of input/output
More informationCSCD 330 Network Programming
CSCD 330 Network Programming Lecture 8 Client-Server Programming Threads Spring 2017 Reading: Chapter 2, Relevant Links - Threads Some Material in these slides from J.F Kurose and K.W. Ross All material
More informationJava for Interfaces and Networks (DT3010, HT11)
Java for Interfaces and Networks (DT3010, HT11) Networking with Threads and Federico Pecora School of Science and Technology Örebro University federico.pecora@oru.se Federico Pecora Java for Interfaces
More informationPROGRAMMAZIONE AVANZATA JAVA E C
PROGRAMMAZIONE AVANZATA JAVA E C Massimiliano Redolfi Lezione 12: networks with Java TCP vs UDP https://docs.oracle.com/javase/tutorial/networking/overview/networking.html TCP vs UDP TCP (Transmission
More informationAssignment, part1: feedback and common mistakes. INFO-0010 Samuel HIARD
Assignment, part1: feedback and common mistakes INFO-0010 Samuel HIARD Grades? Not yet Work done at ~70-80% ETA : First week after Spring holidays (should be) Content of the presentation The code of all
More information