!"# $ %!&' # &! ())*!$
|
|
|
- Theresa Franklin
- 10 years ago
- Views:
Transcription
1 !"# $ %!&' # &! ())*!$
2
3 !" #!$ %& ' ( ) * +,--!&"" $.!! /+010!"
4 +!, 31! 4)&/0! $ #"5!! & + 6+ " /&8-9%& ( +" 5)& /*#.! &( $ 1(" 5 # ( # + 7$ (+!98 +&%& ( +!" (!+!/ (! (! 7 1+1( & + ":! " (&, 71( $ $ 1( 0" 5;<=>/ &&! 9?@!=0 1"A!070$ 1! $0&7 B & + " 5@?9 1& 0"&7$ +1 &&70$ &&$1 &" 71( + 1( $"C $ 0/ & +" 2
5 (!(!/0&1&2 E( 7 " 5@?9 0 = 12+"5@?98-9;" ("5 0+!( * (.0 " (01 7 ( & ( " 5 & +! *9." *8.+0 +" 7&"";""""+ & (" 5F'8=<;/ !1" 5 $! 1 (1+" 5! 9&2 0G 27(1" 5 1 ( 1 1 " D
6 590 + " (1& 70$ 1! 1& "5 &0$ 7 $ & +" " " 8 & 70$ +"&!& "9 7 0( $1&7" 5 8/ F'8 =</ 0 " 8! ( 7 0( 0 " 1! & "#! $ (" 5+& 1 & $+ 1 " 3$+1( 4*+"0+1. " : / $ (" 5>E /; &7 (" & $+ 1 IJ 7 4! ((" " $0 " & &7, 5K/,?LM?NOP K5/, 58?NOP?LM?NOL 5K/, 58?NOL 5" 0$ + (0 0" H
7 85 8K?NO;2?LM?NO58O;D?LM58?NO;D58O258!" & +1 " 8! 0 0 & & $ ( 1 &"5 1 1 $&" & 0 '9M &!" 0,70! & 1 0(0+!+1 +1"5 $ ( +1 77! $ " # $%& 59/1+7 +C3/ +8/!"C3/+!"#*3M?. 0 7& &91 "8+ $ *'./ +!*?:@5@ 9:5.&QQQ *#." (!*!/ 3 5 $ $! +1 (+&((!$"5%& &!1/+!1" C G 0$ 1(*98.&( $ 1( &+ =
8 & 1/ " 5 1/ 1!$B $ & ( " 5 1/+ + E &!" $ ( *&. B*.+77 & " 5 & &! 0$( " & 1/! ( *+.! 10&&!&7"5! 1/! & & & 1 1/ 1& $ $ 1(" $ 0 " 0 " 51&/ & "# $ & 1 +!&70!0 " 0 & 1! 1/! $ 1( $ 1( ( 0 1 &! 1 0" & & + $ ++ &" (! 1 & " 3+ *+"C3.! 01/+$ 0"1(0 " #$ '$?1/ 0 ( +1 $ + " 5 7 ( 1 0 $ " 9 & + G+1 ( 1 " 5 1/ ( (0 (+ 1 "! 0 +&(!( + 1((!(" 5 ( 47 & &$ + (+1(07$ " ( ( & ( R
9 + +" 8/ &! * + ". (!4!/-.5 &3 5#+ 7& &9 " 7 &(! #->"< & " # 0& #-;">! F'8 H;H/ F'8 H;=/ 0! & &7 #-;"; & " 5 + &0 + " 5 + ( &! " :& ( +1 + &( * " 0/$+G. 1 & + /0&" 5+E&+"5+&7 E&& 4 #/ ( 4 &( ( "5 1(,+10+ $ #&&"5+1 0! &0!77+" 0 ( 7I?+J! " 5#7, 5#+ 170 #0!1 " 0! +,! "# $%&'"'( % )$$# )****( +,- ).$$*"/ *"'3#,%+3)'"*56//7'//8( - ) 9 9$$ 9$$ 9# $:9$ 9 # $3;</"= 9 $3;</">?3;</"6@@3;</"'( -,A )#, 3;</"*( -,)$ ( -,B# )CD,>>*=,6,>3;</"8@3;</"8( E,-$)7//( B ),$( <
10 ( 5 S! & ($! " Q ) 8FTA' C G + A'" 5 0!/! & " " 5 7 # + 1! $! & 70" -$1- U11" 0"5 (#-;";! +#;";&(!&" 5&7/0!1 01( 7"5F'8H;H/ 2< 0!1& 0 &"+ +7, '!1 # C/ % 570 / (!+!"G& 0 " 5 *! 7.!" 5 0 +$B IVOJ +$ +0 " 511+/A $ 50 &07" 511+/ 1 50(+0$"$I+J! +/+$ $ $ " 511+/8 +/5& " 8 #-;";/ "9! >>+(! & / &! &$ +1 " 5 0!1 +10! &! &7+G& " 5#&7, /&($ W0!1 W 5& +$&7, %&'"'6//DE( F )C 6GD 6//7'*)*6)'6.( C).1HC"/"6( B,A #)>/( B,) 9 # $( ( I# $JI#JI $J( %$$I $JI#J( IHJ%$$IHJI# $J( ;>
11 5& #&(! & 7"!7 ($(&&&"&&0!1 &+( &" 5 0!1! &" R ( & +7 1 & *+"+&(". 5 0!10, '!1?& 8 /A 8 /+ % 5& (&!" 5&!/ " 5+$" 5# &7/ & 0& 4, & " ($) $ 5 # 7 $ +1 0+&$"5 %&'#!&0 $ & +1 "5% /$ &! +1" 5 4 & )& +!$ $ $ " *!/" 5%& & +&7 (/!&" 1!" A 7 & /+ / +1 ;;
12 " %&! 8 +! /+$ 1(&(" 5%& & +8-9 (+1 1/!$+ 1(!0K?3 1/! " *!+!637 5 %&/ 1/ &( 0 7 K?3 1 01/ 0 "?1/(#))&+ & $ " 5$ 1(%&07 (/&(($& &(!$ "! 7 1 & 9-@ 4&" 5 $ 1( 0!& (#))& ($& 1/ "?& 1 (#))#& $ $+! 1/&!$ " serversocket = new ServerSocket(4444); catch (IOException e) { System.out.println("Could not listen on port: 4444"); System.exit(-1); & ( & ($ $$ 0 " "" + 07 &! 1, Socket clientsocket = null; clientsocket = serversocket.accept(); catch (IOException e) { System.out.println("Accept failed: 4444"); System.exit(-1); C3 1 &!$ 7 $ 1( %& (#))!*&(#))!+&&" 5 $ 1( + $ &!$" A 7 1 "!& $ 1( 0 7 (,) 5 -+ ($ ;
13 !"! ( & ( / 0 +$00 " C3 G 7 & 0 ( 1!" 5.#))&&#&+ 1(! +( / & + &(( "!$+ ( * &!$(. *101.&!" 4!/.38 5 #-;"; 0+ $ 1 +!$"?4)&0+ 1"5& " 5+&7 + 0$!$ G 0 ( & +$00 " 7 ( 7 $ $!&"? & D (" + &7, Q&, ?&,$! ++ & :, 01(0++1( Q1 3, &47$/1 $&(! 8 0,)& 0$ (+ 4!+!/039 5 &40+4"8!0++1 " 8$+ $ + + ;
14 +!( 7" " & " # ($" 5 +" ($ 0++1!&" 4!*!/ )& 0$ (+ "? $ $0/#)0& +0" 5 )&" & 0" 5 )& 0$1(! $!, &( ($ & *+" && & 1 &$ + B )&" & (& ". 0 0$0 &("5/ 4 " 5 & $ 07 +/0$"X!! 0/ & 70 &!$*+"!." M G!Y 5 )&" 0& (, K9B #9 H $ 9B <GL 5+(, if (templine.touppercase().startswith("maxconnections")){ int index=templine.lastindexof("="); buffersize=integer.parseint(templine.substring(index+1)); catch (Exception ex){ System.out.println("Config(): Set maxconnections to "+buffersize); 5$00?&( 7 +! 0$ +" IOJ!$ & &" 58 0 $ 7& 7! +, ;2
15 A 5 & & "5& & &" G8 1 5G " 6+ 1 #!& : +1 & ( "#7!$" $00? 570 +$00" 5+0 $ " 4!*!/: ($+++!!"5 ($$ $&(($*(!$+!!.4 + "Z ($(+ " public static void main(string args[]) { WebServer myserver=new WebServer(); myserver.serve(args); 5#++01($&& 1"5+ $ & +! " 5 + $ $+ 0 7, $ +<>>>/++" 5 ($ +! + &( $ &)& 0$1(!"5+ $!#&' *& 0$. + " 1/ $ 0 1! !" ServerSocket srvr = new ServerSocket(port); System.out.println( "Serving requests on port "+port+"..." ); Socket tempclientsocket; (# *+ 5 $!$ $ %& +"5";"+!&7+1( ;D
16 ($ && $$ 0 " ($ & +! + 0$& 7 1 & 0$ + "! + 1!&7)& 10" 0$ & +$ (&!(& &0$( +" &$ & + & 8C 7+$ "Z (& & " A $ # 2 +$!$ & ( $ &(!$" ServerThread tempthread; while( true ) { if (ConnectionManager.getNrOfConnections()<Config.maxConnections){ tempclientsocket = srvr.accept(); tempthread=new ServerThread (tempclientsocket); System.out.println("Accepting connection, this is nr. "+ConnectionManager.getNrOfConnections()); ConnectionManager.addConnection(); tempthread.start(); else{ System.out.println("Error: too many connections, denying request."); / 0$1( G +1" 5 ($ 1 0 1!& & # 2 + +!$ "5+1 &!!!($ &!$" '! 7 0$ 0$ "5%&7!7(&! +! 70$"5 &$ # 2 (!!$+ 0" 5 ( (" ;H
17 4!4!6"2 5 $ & 1 & ( 0 1! 7 3 +$!$ " + # & / " 5 &(*5 (!$., ($ 0$ %& 7! &! 0$ (" 7 7! #:A! &" %& / 7 &! 4 " " 7!$ $ " outtoserver = new PrintStream(clientSocket.getOutputStream() ); infromserver = new BufferedReader(new InputStreamReader( clientsocket.getinputstream())); 5 & +,, & +, ($ 17 $( & 7 0 &(( / &" 5 /4!$(+ (!$ $ "1 $47/1 $ &! / 47 I $J /0$ $ $! &B+" ($ & ( / 4, #))))) &" 5 / 47 I $ J 0 &( & & +$00 &(" $ / &$ $#-($ &&"5-E ( ( ($ & 0$(&! &( + " + 1 $ ( & " 5 & &$ "'! 1 & & 0!1(B $ 7& " 5 7.#),)+ & &!$" 5 7! IJ &!$#*($B F'8 H;H! I2>> K FV$J $ $ & 456,($" ;=
18 5 & ($ & $ *& ( &( 0.0!7 1 (" ((,-.,/0 5 ($ 7 + &$ 7 70 (!! &&& 7 +/ " 1 $& " M 7 & I511+/ 1 J/I+J! I+BVO>J! +0!&" for (int i=0; i<requests.size();i++){ if ((requests.get(i).tostring().touppercase().startswith("accept- ENCODING")) && (requests.get(i).tostring().touppercase().indexof("gzip")!=-1)) { clientsupportsgzip = true; if ((requests.get(i).tostring().touppercase().indexof("gzip;q=0.") ==-1) && (requests.get(i).tostring().touppercase().indexof ("GZIP;Q=0")!=-1)){ clientsupportsgzip = false; 57D"+ 7& 01(" &7!$ +70/!&!&0!1, $ $ &! & +$" 5 4 &1#:A0/$ IG- J+$ +$ " infile=new FileInputStream(requestedFile); outtoserver.print("http/ OK\r\n"); currentdate=new Date(); outtoserver.print("date: "+currentdate.togmtstring()+"\r\n"); outtoserver.print("server: Mini WebServer v."+config.version+"\r\n"); outtoserver.print("content-type: text/html\r\n"); 5 70& +$00 &&" 4!$ ($ && 0! ( ;R
19 *8FTA'A'.70$ 70($ (! &(" 5 +$00 + ( &$ $ +$ 7 ( " 5 $) ($ & &$ 0/ (!& 1!" byte [] buffer = new byte[config.buffersize]; try{ int numbytes = infile.read(buffer, 0, Config.bufferSize); while (numbytes!= -1) { outtoserver.write(buffer, 0, numbytes); numbytes = infile.read(buffer, 0, Config.bufferSize); 5%&&4 7!& 4"# 0 $"$,7&( 7 2 &! I2>2E'M'$ J " 5?& &($ " 1 &! 8 1 : # ($ && 1 & & +1 " 5 & ($ (Q1 3 &!" 4!;!/:3"%3"# 5 & 4 70$ ( &*+" 8+1 (1&." (&(+7& ( & & $" X 70 +$ IJ +1 & G 0 ( +1 " G +1 IJ + +1!+1 0 $ " 5+ " Q1 3 1 $&! ": +1 0 $ Q1 3/ 0 0! +1 &" 5 & 0$1(! 7 &1 +1!$" ;<
20 5 Q1 3 7&( 0 $( &( & " 8C/7& &7" public void run(){ while (canrun){ sleep (3000); catch (InterruptedException ex) { counter+=3; if (counter >= Config.timeOut){ theserver.killconnection(); canrun=false; # ( 0$1( Q1 3 +1!+7!$&($ &&!+1" 5($ $("5( &$ & ($"' & 0$1(!,, & +$00 &$ $/ 70$ +$00 & & $Q1 37+&!+1" +1 5, 7&( 0!$ Q1 30!0$" ;! 8 5 7! # 0 7 "! ( 6+ & CM9P 8+ &! 07 0!11! *+" 8 / 1, (! + ( &+ 01&! " >
21 5! )&! & "A!$! &7/$++17! " ;!+!.3 5 %& 47 4 &" : *8,, 47 & 1! 0 " 5 *8,,!&"$"+ 1 (" outtoserver.flush(); mywatchdog.reset(); gzout=new GZIPOutputStream (outtoserver); int numbytes = infile.read(buffer, 0, Config.bufferSize); while (numbytes!= -1) { mywatchdog.reset(); gzout.write(buffer, 0, numbytes); numbytes = infile.read(buffer, 0, Config.bufferSize); gzout.close(); 5, #),2 &!$ +$00 ( 1 & &" 5%& $ 7 1 +, ($&, # ($&!$ "' *8,, + & 7&7! $ $ & 1! 69 0!1 $ & "51 +,) &!$" ;!(!8 5 0/ 7! & "! 4+1&! +" 5 8C!! &!$ 0/ & B& & " X +$( &" (+1! " 11 ;
22 "9 (07 1$(" 0/ &!$0/!" 5 & 0/*1 G ". & &" HDR 7! #:A ;2; P 0/ 4!! 69&"5 &7 (, +$ :7*K. :$ *K. [ #:A ''*=*> 6*''L 6'G*M P G/G** ==78 'G7>M : +$ & $ 69 " 5 ( ( &"# & 0/( 0 0! QK 1#:AP("5+&(%&1 &$' 1( 7 & (&" 5 : 7 0!7 $ &" 5 8MM +!! &" : R"R + 4 4&H2"2+1 ;R2"2+1 ">[/& "
23 <=9:68 9:68 28 /** Mini Web-Server *This is a mini web server for demonstration purposes. *It is written by Istvan Farkas with the very useful help of Gabor Paller. */ import java.io.*; import java.net.*; import java.util.*; import java.util.zip.gzipoutputstream; import java.text.*; class WatchDog extends Thread{ private ServerThread theserver; private int counter=0; private boolean canrun=true; WatchDog(ServerThread theserver){ this.theserver=theserver; this.setdaemon(true); public void reset(){ counter=0; public void disable (){ canrun=false; public void run(){ while (canrun){ sleep (3000); catch (InterruptedException ex) { counter+=3; if (counter >= Config.timeOut){ theserver.killconnection(); canrun=false; // run // class ServerThread extends Thread{ private Socket clientsocket; private Vector requests; // vector of all lines of request private Vector currentrequest; // elements of request line being parsed private String beforelaststringread,laststringread; // the last string read while reading the req private PrintStream outtoserver; private GZIPOutputStream gzout; private BufferedReader infromserver; private Date currentdate; //will get value when comm ing with client private StringTokenizer tokenizer=null; //used to tokenize the current
24 private WatchDog mywatchdog; request ServerThread (Socket clientsocket){ this.clientsocket=clientsocket; requests=new Vector(); currentrequest=new Vector(); mywatchdog=new WatchDog(this); mywatchdog.start(); public void serveget(){ String filename=null; // name of requested file File requestedfile=null; //the requested file as an object FileInputStream infile=null; boolean clientsupportsgzip=false; // Now serving a get. At the call of this function, currentrequest contains line 1 of the request. if (currentrequest.get(1).tostring().equals("/")) { filename = "index.html"; else { filename = currentrequest.get(1).tostring(); System.out.println("serveGet(): Requested filename: "+filename); //now detect whether client supports gzip for (int i=0; i<requests.size();i++){ if ((requests.get(i).tostring().touppercase().startswith("accept- ENCODING")) && (requests.get(i).tostring().touppercase().indexof("gzip")!=-1)) { clientsupportsgzip = true; if ((requests.get(i).tostring().touppercase().indexof ("GZIP;Q=0.")==-1) && (requests.get(i).tostring().touppercase(). indexof ("GZIP;Q=0")!=-1)){ clientsupportsgzip = false; // false if q=0 but not q=0.x requestedfile=new File(Config.basePath,fileName); infile=new FileInputStream(requestedFile); mywatchdog.reset(); outtoserver.print("http/ OK\r\n"); currentdate=new Date(); outtoserver.print("date: "+currentdate.togmtstring()+"\r\n"); outtoserver.print("server: Mini WebServer v."+config.version+"\r\n"); outtoserver.print("content-type: text/html\r\n"); if (Config.enableGZipEncoding && clientsupportsgzip) { outtoserver.print("content-encoding: gzip\r\n"); else { outtoserver.print("content-length: "+requestedfile.length()+"\r\n"); outtoserver.print("\r\n"); 2
25 if (Config.enableGZipEncoding && clientsupportsgzip){ //GZipped byte [] buffer = new byte[config.buffersize]; try{ outtoserver.flush(); mywatchdog.reset(); gzout=new GZIPOutputStream (outtoserver); int numbytes = infile.read(buffer, 0, Config.bufferSize); while (numbytes!= -1) { mywatchdog.reset(); gzout.write(buffer, 0, numbytes); numbytes = infile.read(buffer, 0, Config.bufferSize); gzout.close(); catch (IOException ioex){ System.out.println("DEBUG: Exception occured while GZiptransferring file."); ioex.printstacktrace(); else { //normal, uncompressed transfer byte [] buffer = new byte[config.buffersize]; try{ mywatchdog.reset(); int numbytes = infile.read(buffer, 0, Config.bufferSize); while (numbytes!= -1) { mywatchdog.reset(); outtoserver.write(buffer, 0, numbytes); numbytes = infile.read(buffer, 0, Config.bufferSize); catch (IOException ioex){ System.out.println("DEBUG: Exception occured while transferring file."); ioex.printstacktrace(); // end of else infile.close(); catch (Exception ex){ System.out.println("DEBUG: error occured while closing input file"); catch (FileNotFoundException ex){ // 404 String messagecontent="<html>\n<h1>404 - File Not Found</H1>\n"+ "Mini WebServer could not find the file you requested.<br>\n"+ "The filename you specified was: <strong>"+filename+ "</strong><br>\nplease try again.<br><br>mini WebServer v."+config.version+ " - written by Istvan Farkas in 2003\n"+ "<br>many heartfelt thanks to Gabor Paller. </HTML>"; mywatchdog.reset(); outtoserver.print("http/ File Not Found\r\n"); currentdate=new Date(); outtoserver.print("date: "+currentdate.togmtstring()+"\r\n"); outtoserver.print("server: Mini WebServer D
26 v."+config.version+"\r\n"); outtoserver.print("content-type: text/html\r\n"); outtoserver.print("content-length: "+messagecontent.length()+"\r\n\r\n"); outtoserver.print(messagecontent); return; public void tellbadrequest (){ // Called on unsupported HTTP command String messagecontent = "<HTML>\n<H1>400 - Bad Request</H1>\n" + "Sorry, but Mini WebServer does not support the HTTP command you requested.<br>\n" + "\nplease try again.<br><br>mini WebServer v."+config.version + " - written by Istvan Farkas in 2003\n" + "<br>many heartfelt thanks to Gabor Paller. </HTML>"; mywatchdog.reset(); outtoserver.print("http/ Bad Request\r\n"); currentdate = new Date(); outtoserver.print("date: " + currentdate.togmtstring()+"\r\n"); outtoserver.print("server: Mini WebServer v." + Config.version+"\r\n"); outtoserver.print("content-type: text/html\r\n"); outtoserver.print("content-length: " + messagecontent.length() + "\r\n\r\n"); outtoserver.print(messagecontent); return; catch (Exception ex) { System.out.println("DEBUG: Exception occured while writing to outtoserver"); public void killconnection(){ // to terminate connection System.out.println("ERROR: No active transfer for the determined timeout period - closing socket."); System.out.println("Closing connection on port "+clientsocket.getport()+" with address: "+clientsocket.getinetaddress()); ConnectionManager.removeConnection(); try{ clientsocket.close(); catch (Exception ex){ System.out.println("Debug: exception occured while closing the timed out transfer socket."); public void run(){ System.out.println("Activated connection on port "+clientsocket.getport()+" with address: "+clientsocket.getinetaddress()); outtoserver = new PrintStream( clientsocket.getoutputstream() ); infromserver = new BufferedReader( new InputStreamReader( clientsocket.getinputstream())); //now read all requests into a vector do { H
27 laststringread=infromserver.readline(); requests.add(laststringread); catch (IOException ex){ while ((laststringread.length()>0)); tokenizer=new StringTokenizer((String)requests.get(0)); while (tokenizer.hasmoretokens()) { currentrequest.add(tokenizer.nexttoken()); // Calls to serve different HTTP commands if (currentrequest.get(0).tostring().touppercase().startswith("get")) { serveget(); // else if... else { // Unsupported command tellbadrequest(); // The approriate function has finished serving request, now close connection. System.out.println("Closing connection on port "+clientsocket.getport()+" with address: "+clientsocket.getinetaddress()); ConnectionManager.removeConnection(); mywatchdog.disable(); clientsocket.close(); // The Thread will finish after this point. catch (IOException ex){ ex.printstacktrace(); // class Config{ //here we declare the config variables as static ones. We also give them default values. static final String version="0.2"; static String basepath="."; // the directory from which we are serving files static int buffersize=1024; static int maxconnections=64; static boolean enablegzipencoding=true; static int timeout=60; Config(){ //The constructor will read config from WebServer.ini BufferedReader inifile=null; inifile = new BufferedReader( new FileReader("WebServer.ini")); catch (FileNotFoundException ex){ System.out.println("Unable to read WebServer.ini, falling back to default configuration values..."); return; String templine=null; // the last line we read while parsing ini file do { =
28 templine=inifile.readline(); if (templine.touppercase().startswith("basepath")){ int index=templine.lastindexof("="); basepath=templine.substring(index+1); System.out.println("Config(): Set basepath to "+basepath); if (templine.touppercase().startswith("buffersize")){ int index=templine.lastindexof("="); buffersize=integer.parseint(templine.substring(index+1)); catch (Exception ex){ System.out.println("Config(): Set buffersize to "+buffersize+ " bytes"); if (templine.touppercase().startswith("maxconnections")){ int index=templine.lastindexof("="); buffersize=integer.parseint(templine.substring(index+1)); catch (Exception ex){ System.out.println("Config(): Set maxconnections to "+buffersize); if (templine.touppercase().startswith("enablegzipencoding")){ int index=templine.lastindexof("="); if (Integer.parseInt(tempLine.substring(index+1))==0) enablegzipencoding=false; catch (Exception ex){ System.out.println("Config(): Set enablegzipencoding to "+enablegzipencoding); if (templine.touppercase().startswith("timeout")){ int index=templine.lastindexof("="); timeout=integer.parseint(templine.substring(index+1)); catch (Exception ex){ if (timeout<10) timeout=10; System.out.println("Config(): Set timeout to "+timeout+" seconds."); catch (Exception ex){ while (templine!= null); // class ConnectionManager{ private static int nrofconnections=0; public static void addconnection(){ nrofconnections++; R
29 public static void removeconnection(){ if (nrofconnections!=0) { nrofconnections--; public static int getnrofconnections(){ return nrofconnections; // public class WebServer { int port=9000; // Where we are listening, default value is 9000 public void serve(string args[]){ System.out.println("\nSimple WebServer version "+Config.version+" \n"); port=integer.parseint(args[0]); catch (Exception ex){ System.out.println("Error parsing input port from args[0], falling back to default (9000)."); Config myconfig=new Config(); ServerSocket srvr = new ServerSocket(port); System.out.println( "Serving requests on port "+port+"..." ); Socket tempclientsocket; ServerThread tempthread; while( true ) { if (ConnectionManager.getNrOfConnections()<Config.maxConnections){ tempclientsocket = srvr.accept(); tempthread=new ServerThread (tempclientsocket); System.out.println("Accepting connection, this is nr. "+ConnectionManager.getNrOfConnections()); ConnectionManager.addConnection(); tempthread.start(); else { System.out.println("Error: too many connections, denying request."); catch( IOException ex ) { ex.printstacktrace(); System.out.println("Could not create server socket, maybe already in use."); return; public static void main(string args[]) { WebServer myserver=new WebServer(); myserver.serve(args); // <
30 " 2 F'8=<; +,--)))"0V"-01-01=<;" F'8=< +,--)))"0V"-01-01=<" F'8H;H +,--)))"0V"-01-01H;H" 5 )?" $,?(+/ ( * / 1/#;<<<. % 1K,0 1,#1+ +,--)))""-+! K$$ ),#)%&&Q +,--)))" "1-+$--!&->>->2--!&U)&" N$#": $,?1+ %&,$ +,--)))"!&)"1-!&)-!)/;/;<<H-!)/;/1"?$ %&$,8$M) +,--!&"$ "1-1--$- ) -1-1?&" >
Building a Multi-Threaded Web Server
Building a Multi-Threaded Web Server In this lab we will develop a Web server in two steps. In the end, you will have built a multi-threaded Web server that is capable of processing multiple simultaneous
Creating a Simple, Multithreaded Chat System with Java
Creating a Simple, Multithreaded Chat System with Java Introduction by George Crawford III In this edition of Objective Viewpoint, you will learn how to develop a simple chat system. The program will demonstrate
Division of Informatics, University of Edinburgh
CS1Bh Lecture Note 20 Client/server computing A modern computing environment consists of not just one computer, but several. When designing such an arrangement of computers it might at first seem that
Application Development with TCP/IP. Brian S. Mitchell Drexel University
Application Development with TCP/IP Brian S. Mitchell Drexel University Agenda TCP/IP Application Development Environment Client/Server Computing with TCP/IP Sockets Port Numbers The TCP/IP Application
String sentence = new String(receivePacket.getData()); InetAddress IPAddress = receivepacket.getaddress(); int port = receivepacket.
164 CHAPTER 2 APPLICATION LAYER connection requests, as done in TCPServer.java. If multiple clients access this application, they will all send their packets into this single door, serversocket. String
Advanced Network Programming Lab using Java. Angelos Stavrou
Advanced Network Programming Lab using Java Angelos Stavrou Table of Contents A simple Java Client...3 A simple Java Server...4 An advanced Java Client...5 An advanced Java Server...8 A Multi-threaded
Mail User Agent Project
Mail User Agent Project Tom Kelliher, CS 325 100 points, due May 4, 2011 Introduction (From Kurose & Ross, 4th ed.) In this project you will implement a mail user agent (MUA) that sends mail to other users.
Assignment 4 Solutions
CSCI 312 - DATA COMMUNICATIONS AND NETWORKS FALL, 2014 Assignment 4 Solutions Working as a pair Working in pairs. When you work as a pair you have to return only one home assignment per pair on a round.
Chulalongkorn University International School of Engineering Department of Computer Engineering 2140105 Computer Programming Lab.
Chulalongkorn University Name International School of Engineering Student ID Department of Computer Engineering Station No. 2140105 Computer Programming Lab. Date Lab 2 Using Java API documents, command
Question1-part2 What undesirable consequences might there be in having too long a DNS cache entry lifetime?
CSCI 312 - DATA COMMUNICATIONS AND NETWORKS FALL, 2014 Assignment 4 Working as a group. Working in small gruops of 2-4 students. When you work as a group, you have to return only one home assignment per
Lesson: All About Sockets
All About Sockets http://java.sun.com/docs/books/tutorial/networking/sockets/index.html Page 1 sur 1 The Java TM Tutorial Start of Tutorial > Start of Trail Trail: Custom Networking Lesson: All About Sockets
Java Network. Slides prepared by : Farzana Rahman
Java Network Programming 1 Important Java Packages java.net java.io java.rmi java.security java.lang TCP/IP networking I/O streams & utilities Remote Method Invocation Security policies Threading classes
Threads in der Client/Server-Programmierung mit Java
Threads in der Client/Server-Programmierung mit Java Zahlenraten: Protokoll CLIENT / Comm? Comm! / max / SERVER Comm? / Comm! / 100 trial / / cmp(trial) [ cmp(trial) = < or cmp(trial) = > ] [ answer =
Network Communication
Network Communication Outline Sockets Datagrams TCP/IP Client-Server model OSI Model Sockets Endpoint for bidirectional communication between two machines. To connect with each other, each of the client
TP1 : Correction. Rappels : Stream, Thread et Socket TCP
Université Paris 7 M1 II Protocoles réseaux TP1 : Correction Rappels : Stream, Thread et Socket TCP Tous les programmes seront écrits en Java. 1. (a) Ecrire une application qui lit des chaines au clavier
Introduction to Java. Module 12: Networking (Java Sockets) Prepared by Costantinos Costa for EPL 233. ΕΠΛ233 Αντικειμενοστρεφής Προγραμματισμός 1
Introduction to Java Module 12: Networking (Java Sockets) Prepared by Costantinos Costa for EPL 233 ΕΠΛ233 Αντικειμενοστρεφής Προγραμματισμός 1 What Is a Socket? A socket is one end-point of a two-way
Network Programming using sockets
Network Programming using sockets TCP/IP layers Layers Message Application Transport Internet Network interface Messages (UDP) or Streams (TCP) UDP or TCP packets IP datagrams Network-specific frames Underlying
Learning Outcomes. Networking. Sockets. TCP/IP Networks. Hostnames and DNS TCP/IP
CP4044 Lecture 7 1 Networking Learning Outcomes To understand basic network terminology To be able to communicate using Telnet To be aware of some common network services To be able to implement client
Java Network Programming. The java.net package contains the Socket class. This class speaks TCP (connection-oriented protocol).
Java Network Programming The java.net package contains the Socket class. This class speaks TCP (connection-oriented protocol). The DatagramSocket class uses UDP (connectionless protocol). The java.net.socket
Using Files as Input/Output in Java 5.0 Applications
Using Files as Input/Output in Java 5.0 Applications The goal of this module is to present enough information about files to allow you to write applications in Java that fetch their input from a file instead
www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk
CS506 Web Design and Development Solved Online Quiz No. 01 Which of the following is a general purpose container? JFrame Dialog JPanel JApplet Which of the following package needs to be import while handling
Data Communication & Networks G22.2262-001
Data Communication & Networks G22.2262-001 Session 10 - Main Theme Java Sockets Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences 1 Agenda
Java Programming Unit 10. Stock Price Quotes with URL, Sockets, and RMI
Java Programming Unit 10 Stock Price Quotes with URL, Sockets, and RMI GeFng Stock Quotes From Yahoo! 1. Visit hjp://finance.yahoo.com, enter AAPL - the symbol of the Apple s stock, and press the bujon
public static void main(string[] args) { System.out.println("hello, world"); } }
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
Threads & Tasks: Executor Framework
Threads & Tasks: Executor Framework Introduction & Motivation WebServer Executor Framework Callable and Future 12 April 2012 1 Threads & Tasks Motivations for using threads Actor-based Goal: Create an
Manual. Programmer's Guide for Java API
2013-02-01 1 (15) Programmer's Guide for Java API Description This document describes how to develop Content Gateway services with Java API. TS1209243890 1.0 Company information TeliaSonera Finland Oyj
This material is built based on, Patterns covered in this class FILTERING PATTERNS. Filtering pattern
2/23/15 CS480 A2 Introduction to Big Data - Spring 2015 1 2/23/15 CS480 A2 Introduction to Big Data - Spring 2015 2 PART 0. INTRODUCTION TO BIG DATA PART 1. MAPREDUCE AND THE NEW SOFTWARE STACK 1. DISTRIBUTED
Chapter 2 Introduction to Java programming
Chapter 2 Introduction to Java programming 1 Keywords boolean if interface class true char else package volatile false byte final switch while throws float private case return native void protected break
INPUT AND OUTPUT STREAMS
INPUT AND OUTPUT The Java Platform supports different kinds of information sources and information sinks. A program may get data from an information source which may be a file on disk, a network connection,
DNS: Domain Names. DNS: Domain Name System. DNS: Root name servers. DNS name servers
DNS: Domain Name System DNS: Domain Names People: many identifiers: SSN, name, Passport # Internet hosts, routers: Always: IP address (32 bit) - used for addressing datagrams Often: name, e.g., nifc14.wsu.edu
! "# $%&'( ) * ).) "%&' 1* ( %&' ! "%&'2 (! ""$ 1! ""3($
! "# $%&'( ) * +,'-( ).) /"0'" 1 %&' 1* ( %&' "%&'! "%&'2 (! ""$ 1! ""3($ 2 ', '%&' 2 , 3, 4( 4 %&'( 2(! ""$ -5%&'* -2%&'(* ) * %&' 2! ""$ -*! " 4 , - %&' 3( #5! " 5, '56! "* * 4(%&'(! ""$ 3(#! " 42/7'89.:&!
Network/Socket Programming in Java. Rajkumar Buyya
Network/Socket Programming in Java Rajkumar Buyya Elements of C-S Computing a client, a server, and network Client Request Result Network Server Client machine Server machine java.net Used to manage: URL
Socket-based Network Communication in J2SE and J2ME
Socket-based Network Communication in J2SE and J2ME 1 C/C++ BSD Sockets in POSIX POSIX functions allow to access network connection in the same way as regular files: There are special functions for opening
CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O
CSE 1223: Introduction to Computer Programming in Java Chapter 7 File I/O 1 Sending Output to a (Text) File import java.util.scanner; import java.io.*; public class TextFileOutputDemo1 public static void
Socket Programming. Announcement. Lectures moved to
Announcement Lectures moved to 150 GSPP, public policy building, right opposite Cory Hall on Hearst. Effective Jan 31 i.e. next Tuesday Socket Programming Nikhil Shetty GSI, EECS122 Spring 2006 1 Outline
13 File Output and Input
SCIENTIFIC PROGRAMMING -1 13 File Output and Input 13.1 Introduction To make programs really useful we have to be able to input and output data in large machinereadable amounts, in particular we have to
ExempleRMI.java. // Fichier de defintion des droits et proprietes // System.setProperty("java.security.policy","../server.java.
ExempleRMI.java import java.lang.*; import java.rmi.registry.*; import java.rmi.server.*; import java.io.*; import java.util.*; ExempleRMI.java import pkgexemple.*; public class ExempleRMI public static
Transport layer protocols. Message destination: Socket +Port. Asynchronous vs. Synchronous. Operations of Request-Reply. Sockets
Transport layer protocols Interprocess communication Synchronous and asynchronous comm. Message destination Reliability Ordering Client Server Lecture 15: Operating Systems and Networks Behzad Bordbar
The Java I/O System. Binary I/O streams (ascii, 8 bits) The decorator design pattern Character I/O streams (Unicode, 16 bits)
Binary I/O streams (ascii, 8 bits) InputStream OutputStream The Java I/O System The decorator design pattern Character I/O streams (Unicode, 16 bits) Reader Writer Comparing Binary I/O to Character I/O
Socket Programming in Java
Socket Programming in Java Learning Objectives The InetAddress Class Using sockets TCP sockets Datagram Sockets Classes in java.net The core package java.net contains a number of classes that allow programmers
Socket programming. Socket Programming. Languages and Platforms. Sockets. Rohan Murty Hitesh Ballani. Last Modified: 2/8/2004 8:30:45 AM
Socket Programming Rohan Murty Hitesh Ballani Last Modified: 2/8/2004 8:30:45 AM Slides adapted from Prof. Matthews slides from 2003SP Socket programming Goal: learn how to build client/server application
Files and input/output streams
Unit 9 Files and input/output streams Summary The concept of file Writing and reading text files Operations on files Input streams: keyboard, file, internet Output streams: file, video Generalized writing
An Overview of Java. overview-1
An Overview of Java overview-1 Contents What is Java Major Java features Java virtual machine Java programming language Java class libraries (API) GUI Support in Java Networking and Threads in Java overview-2
File class in Java. Scanner reminder. Files 10/19/2012. File Input and Output (Savitch, Chapter 10)
File class in Java File Input and Output (Savitch, Chapter 10) TOPICS File Input Exception Handling File Output Programmers refer to input/output as "I/O". The File class represents files as objects. The
EVALUATION OF TOOLS FOR CYBER SECURITY
Project report 2: EVALUATION OF TOOLS FOR CYBER SECURITY By Piyali Basak Indian Institute of Technology, Kanpur Guided by Dr. N.P. Dhavale Deputy General Manager, Strategic Business Unit, Institute for
public class demo1swing extends JFrame implements ActionListener{
import java.io.*; import java.net.*; import java.io.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; public class demo1swing extends JFrame implements ActionListener JButton demodulacion;
Apéndice C: Código Fuente del Programa DBConnection.java
Apéndice C: Código Fuente del Programa DBConnection.java import java.sql.*; import java.io.*; import java.*; import java.util.*; import java.net.*; public class DBConnection Connection pgsqlconn = null;
gomobi Traffic Switching Guide Version 0.9, 28 September 2010
gomobi Traffic Switching Guide Version 0.9, 28 September 2010 Mobile/Desktop Traffic Switching... 3 Summary of Options... 3 Single Site Solutions... 4 Server-side Switching Code... 4 JavaScript Switching
CS 121 Intro to Programming:Java - Lecture 11 Announcements
CS 121 Intro to Programming:Java - Lecture 11 Announcements Next Owl assignment up, due Friday (it s short!) Programming assignment due next Monday morning Preregistration advice: More computing? Take
Input / Output Framework java.io Framework
Date Chapter 11/6/2006 Chapter 10, start Chapter 11 11/13/2006 Chapter 11, start Chapter 12 11/20/2006 Chapter 12 11/27/2006 Chapter 13 12/4/2006 Final Exam 12/11/2006 Project Due Input / Output Framework
Word Count Code using MR2 Classes and API
EDUREKA Word Count Code using MR2 Classes and API A Guide to Understand the Execution of Word Count edureka! A guide to understand the execution and flow of word count WRITE YOU FIRST MRV2 PROGRAM AND
CISC 4700 L01 Network & Client- Server Programming Spring 2016. Harold, Chapter 8: Sockets for Clients
CISC 4700 L01 Network & Client- Server Programming Spring 2016 Harold, Chapter 8: Sockets for Clients Datagram: Internet data packet Header: accounting info (e.g., address, port of source and dest) Payload:
What is an I/O Stream?
Java I/O Stream 1 Topics What is an I/O stream? Types of Streams Stream class hierarchy Control flow of an I/O operation using Streams Byte streams Character streams Buffered streams Standard I/O streams
COSC 6397 Big Data Analytics. Distributed File Systems (II) Edgar Gabriel Spring 2014. HDFS Basics
COSC 6397 Big Data Analytics Distributed File Systems (II) Edgar Gabriel Spring 2014 HDFS Basics An open-source implementation of Google File System Assume that node failure rate is high Assumes a small
Scanner. It takes input and splits it into a sequence of tokens. A token is a group of characters which form some unit.
Scanner The Scanner class is intended to be used for input. It takes input and splits it into a sequence of tokens. A token is a group of characters which form some unit. For example, suppose the input
A Simple Client-Server Application
A Simple Client-Server Application The Java language has several classes that are used for network programming. They are in the java.net package and are adaptations of the corresponding structures in C.
Using DOTS as Apache Derby System Test
Using DOTS as Apache Derby System Test Date: 02/16/2005 Author: Ramandeep Kaur [email protected] Table of Contents 1 Introduction... 3 2 DOTS Overview... 3 3 Running DOTS... 4 4 Issues/Tips/Hints... 6 5
Hadoop WordCount Explained! IT332 Distributed Systems
Hadoop WordCount Explained! IT332 Distributed Systems Typical problem solved by MapReduce Read a lot of data Map: extract something you care about from each record Shuffle and Sort Reduce: aggregate, summarize,
WRITING DATA TO A BINARY FILE
WRITING DATA TO A BINARY FILE TEXT FILES VS. BINARY FILES Up to now, we have looked at how to write and read characters to and from a text file. Text files are files that contain sequences of characters.
An Android-based Instant Message Application
An Android-based Instant Message Application Qi Lai, Mao Zheng and Tom Gendreau Department of Computer Science University of Wisconsin - La Crosse La Crosse, WI 54601 [email protected] Abstract One of the
When the transport layer tries to establish a connection with the server, it is blocked by the firewall. When this happens, the RMI transport layer
Firewall Issues Firewalls are inevitably encountered by any networked enterprise application that has to operate beyond the sheltering confines of an Intranet Typically, firewalls block all network traffic,
COSC 6397 Big Data Analytics. Mahout and 3 rd homework assignment. Edgar Gabriel Spring 2014. Mahout
COSC 6397 Big Data Analytics Mahout and 3 rd homework assignment Edgar Gabriel Spring 2014 Mahout Scalable machine learning library Built with MapReduce and Hadoop in mind Written in Java Focusing on three
Crash Course in Java
Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is
Tutorial: Getting Started
9 Tutorial: Getting Started INFRASTRUCTURE A MAKEFILE PLAIN HELLO WORLD APERIODIC HELLO WORLD PERIODIC HELLO WORLD WATCH THOSE REAL-TIME PRIORITIES THEY ARE SERIOUS SUMMARY Getting started with a new platform
First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science
First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca
Lecture J - Exceptions
Lecture J - Exceptions Slide 1 of 107. Exceptions in Java Java uses the notion of exception for 3 related (but different) purposes: Errors: an internal Java implementation error was discovered E.g: out
Event-Driven Programming
Event-Driven Programming Lecture 4 Jenny Walter Fall 2008 Simple Graphics Program import acm.graphics.*; import java.awt.*; import acm.program.*; public class Circle extends GraphicsProgram { public void
Xiaoming Gao Hui Li Thilina Gunarathne
Xiaoming Gao Hui Li Thilina Gunarathne Outline HBase and Bigtable Storage HBase Use Cases HBase vs RDBMS Hands-on: Load CSV file to Hbase table with MapReduce Motivation Lots of Semi structured data Horizontal
Continuous Integration Part 2
1 Continuous Integration Part 2 This blog post is a follow up to my blog post Continuous Integration (CI), in which I described how to execute test cases in Code Tester (CT) in a CI environment. What I
CS 1302 Ch 19, Binary I/O
CS 1302 Ch 19, Binary I/O Sections Pages Review Questions Programming Exercises 19.1-19.4.1, 19.6-19.6 710-715, 724-729 Liang s Site any Sections 19.1 Introduction 1. An important part of programming is
File I/O - Chapter 10. Many Stream Classes. Text Files vs Binary Files
File I/O - Chapter 10 A Java stream is a sequence of bytes. An InputStream can read from a file the console (System.in) a network socket an array of bytes in memory a StringBuffer a pipe, which is an OutputStream
NETWORK PROGRAMMING IN JAVA USING SOCKETS
NETWORK PROGRAMMING IN JAVA USING SOCKETS Prerna Malik, Poonam Rawat Student, Dronacharya College of Engineering, Gurgaon, India Abstract- Network programming refers to writing programs that could be processed
php-crypto-params Documentation
php-crypto-params Documentation Release 1.0.0 Gian Luca Dalla Torre January 17, 2016 Contents 1 Purpose 3 2 How it works 5 2.1 Documentation.............................................. 5 i ii php-crypto-params
Building a Java chat server
Building a Java chat server Presented by developerworks, your source for great tutorials Table of Contents If you're viewing this document online, you can click any of the topics below to link directly
Communicating with a Barco projector over network. Technical note
Communicating with a Barco projector over network Technical note MED20080612/00 12/06/2008 Barco nv Media & Entertainment Division Noordlaan 5, B-8520 Kuurne Phone: +32 56.36.89.70 Fax: +32 56.36.883.86
Chapter 20 Streams and Binary Input/Output. Big Java Early Objects by Cay Horstmann Copyright 2014 by John Wiley & Sons. All rights reserved.
Chapter 20 Streams and Binary Input/Output Big Java Early Objects by Cay Horstmann Copyright 2014 by John Wiley & Sons. All rights reserved. 20.1 Readers, Writers, and Streams Two ways to store data: Text
CS 111 Classes I 1. Software Organization View to this point:
CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects
Istanbul Şehir University Big Data Camp 14. Hadoop Map Reduce. Aslan Bakirov Kevser Nur Çoğalmış
Istanbul Şehir University Big Data Camp 14 Hadoop Map Reduce Aslan Bakirov Kevser Nur Çoğalmış Agenda Map Reduce Concepts System Overview Hadoop MR Hadoop MR Internal Job Execution Workflow Map Side Details
ResellerPlus - Bulk Http API Specification. (This Document gives details on how to send messages via the Bulk HTTP API for the RouteSms SMPP System)
RouteSms ResellerPlus - Bulk Http API Specification (Document Version 1.0.0) (This Document gives details on how to send messages via the Bulk HTTP API for the RouteSms SMPP System) 1 P a g e HTTP API
Programmation Orientée Objets. et langage Java
Programmation Orientée Objets et langage Java Programmation procédurale Construire(Maison m){ creuser(fouilles); commander(béton) couler(fouilles); commander(parpaings); while(!fini(sous-sol)){poser(parpaings);
Capario B2B EDI Transaction Connection. Technical Specification for B2B Clients
Capario B2B EDI Transaction Connection Technical Specification for B2B Clients Revision History Date Version Description Author 02/03/2006 Draft Explanation for external B2B clients on how to develop a
Java Fundamental Classes Reference
Java Fundamental Classes Reference Mark Grand and Jonathan Knudsen O'REILLY Cambridge Köln Paris Sebastopol Tokyo v Table of Contents Preface xv 1. Introduction 1 1.1 The java.lang Package 2 1.2 The java.lang.reflect
Stream Classes and File I/O
Stream Classes and File I/O A stream is any input source or output destination for data. The Java API includes about fifty classes for managing input/output streams. Objects of these classes can be instantiated
SETTING UP YOUR JAVA DEVELOPER ENVIRONMENT
SETTING UP YOUR JAVA DEVELOPER ENVIRONMENT Summary This tipsheet describes how to set up your local developer environment for integrating with Salesforce. This tipsheet describes how to set up your local
Consuming a Web Service(SOAP and RESTful) in Java. Cheat Sheet For Consuming Services in Java
Consuming a Web Service(SOAP and RESTful) in Java Cheat Sheet For Consuming Services in Java This document will provide a user the capability to create an application to consume a sample web service (Both
Network Programming. Writing network and internet applications.
Network Programming Writing network and internet applications. Overview > Network programming basics > Sockets > The TCP Server Framework > The Reactor Framework > High Level Protocols: HTTP, FTP and E-Mail
Java Programming: Sockets in Java
Java Programming: Sockets in Java Manuel Oriol May 10, 2007 1 Introduction Network programming is probably one of the features that is most used in the current world. As soon as people want to send or
3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version
Version 3.5 JEFFERSON LAB Data Acquisition Group cmsg Developer s Guide J E F F E R S O N L A B D A T A A C Q U I S I T I O N G R O U P cmsg Developer s Guide Elliott Wolin [email protected] Carl Timmer [email protected]
Preet raj Core Java and Databases CS4PR. Time Allotted: 3 Hours. Final Exam: Total Possible Points 75
Preet raj Core Java and Databases CS4PR Time Allotted: 3 Hours Final Exam: Total Possible Points 75 Q1. What is difference between overloading and overriding? 10 points a) In overloading, there is a relationship
Java Programming Fundamentals
Lecture 1 Part I Java Programming Fundamentals Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Introduction to Java We start by making a few
Running Hadoop on Windows CCNP Server
Running Hadoop at Stirling Kevin Swingler Summary The Hadoopserver in CS @ Stirling A quick intoduction to Unix commands Getting files in and out Compliing your Java Submit a HadoopJob Monitor your jobs
READING DATA FROM KEYBOARD USING DATAINPUTSTREAM, BUFFEREDREADER AND SCANNER
READING DATA FROM KEYBOARD USING DATAINPUTSTREAM, BUFFEREDREADER AND SCANNER Reading text data from keyboard using DataInputStream As we have seen in introduction to streams, DataInputStream is a FilterInputStream
