SOURCE CODE. //Socket Programming using TCP Sockets. Server.java
|
|
- Emerald Gardner
- 5 years ago
- Views:
Transcription
1 SOURCE CODE //Socket Programming using TCP Sockets Server.java import java.io.*; import java.net.*; public class Server public static void main (String args[]) throws Exception ServerSocket sersock=new ServerSocket (3000); System.out.println ("Server ready for chatting"); Socket sock= sersock.accept (); BufferedReader KeyRead= new BufferedReader (new InputStreamReader (System.in)); OutputStream ofstream=sock.getoutputstream (); PrintWriter pwrite=new PrintWriter (ofstream, true); InputStream istream=sock.getinputstream (); BufferedReader receivedread=new BufferedReader (new InputStreamReader (istream)); String receivemessage, sendmessage; while (true) if ((receivemessage=receivedread.readline ())! =null) System.out.println (receivemessage); sendmessage=keyread.readline(); pwrite.println (sendmessage); System.out.flush ();
2 Client.java import java.io.*; import java.net.*; public class Client public static void main (String args[]) throws Exception Socket sock=new Socket (" ", 3000); BufferedReader KeyRead= new BufferedReader (new InputStreamReader (System.in)); OutputStream ofstream=sock.getoutputstream (); PrintWriter pwrite=new PrintWriter (ofstream, true); InputStream istream=sock.getinputstream (); BufferedReader receivedread=new BufferedReader (new InputStreamReader (istream)); System.out.println ("client ready for chatting"); String receivemessage, sendmessage; while (true) sendmessage=keyread.readline (); pwrite.println (sendmessage); System.out.flush (); if ((receivemessage=receivedread.readline ())! =null) System.out.println (receivemessage);
3 OUTPUT SERVER CLIENT
4 SOURCE CODE // Socket Programming using UDP Sockets UDPServer.java import java.io.*; import java.net.*; class UDPServer public static void main(string args[]) throws Exception DatagramSocket serversocket = new DatagramSocket(9876); byte[] receivedata = new byte[1024]; byte[] senddata = new byte[1024]; while(true) DatagramPacket receivepacket = new DatagramPacket(receiveData, receivedata.length); serversocket.receive(receivepacket); String sentence = new String( receivepacket.getdata()); System.out.println("RECEIVED: " + sentence); InetAddress IPAddress = receivepacket.getaddress(); int port = receivepacket.getport(); String capitalizedsentence = sentence.touppercase(); senddata = capitalizedsentence.getbytes(); DatagramPacket sendpacket =new DatagramPacket(sendData, senddata.length, IPAddress, port); serversocket.send(sendpacket);
5 UDPClient.java import java.io.*; import java.net.*; class UDPClient public static void main(string args[])throws Exception BufferedReader informuser= new BufferedReader(new InputStreamReader(System.in)); DatagramSocket clientsocket= new DatagramSocket(); InetAddress IpAddress=InetAddress.getByName("localhost"); byte[] senddata= new byte[1024]; byte[] recedata= new byte[1024]; String sen=informuser.readline(); senddata=sen.getbytes(); DatagramPacket sendpacket= new DatagramPacket(senddata,senddata.length,IpAddress,9876); clientsocket.send(sendpacket); DatagramPacket receivepacket = new DatagramPacket(recedata, recedata.length); clientsocket.receive(receivepacket); String uppersen = new String(receivepacket.getData()); System.out.println("FROM SERVER:\n" + uppersen); clientsocket.close();
6 OUTPUT SERVER CLIENT
7 SOURCE CODE //Applications using SOCKET Serverapp.java import java.io.*; import java.net.*; public class Serverapp public static void main (String args []) throws Exception String rmess, rmess1; ServerSocket sersock=new ServerSocket (3000); Socket sock=sersock.accept (); OutputStream ostream=sock.getoutputstream (); PrintWriter pwrite=new PrintWriter (ostream, true); InputStream istream=sock.getinputstream (); BufferedReader receivedread=new BufferedReader (new InputStreamReader (istream)); rmess =receivedread.readline (); rmess1=receivedread.readline (); System.out.println ("The two strings are: "+rmess+"\n"+rmess1); System.out.println ("After concatenating: "+rmess+rmess1);
8 Clientapp.java import java.io.*; import java.net.*; public class Clientapp public static void main (String args[]) throws Exception String rmess1, rmess2; Socket sock=new Socket (" ", 3000); BufferedReader keyread=new BufferedReader (new InputStreamReader (System.in)); OutputStream ostream=sock.getoutputstream (); PrintWriter pwrite=new PrintWriter (ostream, true); System.out.println ("Enter the string1:"); rmess1=keyread.readline (); System.out.println ("Enter the string2:"); rmess2=keyread.readline (); pwrite.println (rmess1); pwrite.println (rmess2); System.out.flush ();
9 OUTPUT SERVER CLIENT
10 SOURCE CODE // Simulation of Sliding Window Protocol Server.java: import java.io.*; import java.net.*; public class Server public static void main (String args []) throws Exception int [] rm=new int [100]; int lost, n, i, rlost; ServerSocket sersock=new ServerSocket (3000); Socket sock=sersock.accept (); BufferedReader keyread=new BufferedReader (new InputStreamReader (System.in)); OutputStream ofstream=sock.getoutputstream (); PrintWriter pwrite=new PrintWriter (ofstream, true); InputStream istream=sock.getinputstream (); BufferedReader receivedread=new BufferedReader (new InputStreamReader (istream)); n=integer.parseint (receivedread.readline ()); System.out.println ("the frames are:"); for (i=1; i<=n; i++) rm [i] =Integer.parseInt (receivedread.readline ()); System.out.println (rm [i]); System.out.println ("\n Enter the frame to be retransmitted :"); lost=integer.parseint (keyread.readline ()); pwrite.println (lost); rlost=integer.parseint (receivedread.readline ()); System.out.println ("\n The lost frame "+rlost+"is successfully transmitted");
11 Client.java import java.io.*; import java.net.*; public class Client public static void main (String args []) throws Exception int [] f=new int [100]; int receivemessage, n, lf; Socket sock=new Socket (" ", 3000); BufferedReader keyread=new BufferedReader (new InputStreamReader(System.in)); OutputStream ostream=sock.getoutputstream (); PrintWriter pwrite=new PrintWriter (ostream, true); InputStream istream=sock.getinputstream (); BufferedReader receivedread=new BufferedReader (new InputStreamReader (istream)); System.out.println ("enter the number of frames are:"); n=integer.parseint (keyread.readline ()); pwrite.println (n); for (int i=1; i<=n; i++) System.out.println ("enter the frames are:"+i+":"); f[i]=integer.parseint (keyread.readline ()); pwrite.println (f[i]); System.out.println ("\n the frames are:\n"); for (int i=1; i<=n; i++) System.out.println (f[i]); receivemessage =Integer.parseInt (receivedread.readline ()); lf=f [receivemessage]; pwrite.println (lf);
12 SERVER OUTPUT CLIENT
13 SOURCE CODE // Simulation of Routing Protocols #include<stdio.h> struct node unsigned dist[20]; unsigned from[20]; rt[10]; int main() int dmat [20] [20]; int n, i, j, k, count=0; printf ("\nenter the number of nodes: "); scanf ("%d", &n); printf ("\nenter the cost matrix: \n"); for (i=0; i<n; i++) for (j=0; j<n; j++) scanf ("%d", &dmat [i] [j]); dmat[i] [i]=0; rt[i].dist[j]=dmat[i][j]; rt[i].from[j]=j; do count=0; for (i=0; i<n; i++) for (j=0; j<n; j++) for(k=0; k<n; k++) if(rt[i].dist[j]>dmat[i][k]+rt[k].dist[j]) rt [i].dist [j]=rt [i].dist [k]+rt [k].dist [j];
14 rt [i].from[j]=k; count++; while (count! =0); for(i=0; i<n; i++) Printf ("\n\n State value for router %d is \n",i+1); For (j=0; j<n; j++) printf ("\t\n node %d via %d Distance%d", j+1,rt[i].from[j]+1,rt[i].dist [j]); Printf ("\n\n");
15 OUTPUT cc Router.c Enter the number of nodes: 4 Enter the cost matrix: State value for Router 1 is Node 1 via 1 Distance 0 Node 2 via 2 Distance 1 Node 3 via 3 Distance 2 Node 4 via 4 Distance 4 State value for Router 2 is Node 1 via 1 Distance 1 Node 2 via 2 Distance 0 Node 3 via 3 Distance 2 Node 4 via 4 Distance 3 State value for Router 3 is Node 1 via 1 Distance 3 Node 2 via 2 Distance 2 Node 3 via 3 Distance 0 Node 4 via 4 Distance 5 State value for Router 4 is Node 1 via 1 Distance 4 Node 2 via 2 Distance 3 Node 3 via 3 Distance 3 Node 4 via 4 Distance 0
16 SOURCE CODE //Domain Name Service- DNS DNSServer.java import java.io.*; import java.net.*; import java.util.*; class DNSServer public static void main (String args[]) throws Exception DatagramSocket server=new DatagramSocket (1309); while (true) byte[] sendbyte=new byte[1024]; byte[] receivebyte=new byte[1024]; DatagramPacket receiver=new DatagramPacket (receivebyte, receivebyte. length); server.receive (receiver); String str=new String (receiver.getdata()); String s=str.trim (); InetAddress addr=receiver.getaddress (); int port=receiver.getport (); String ip[]=" "," "; String name[]=" for (int i=0; i<=ip.length; i++) if(s.equals(ip[i])) sendbyte=name[i].getbytes (); DatagramPacket sender=new DatagramPacket (sendbyte, sendbyte.length, addr, port); server.send (sender); break; else if (s.equals (name[i])) sendbyte=ip[i].getbytes ();
17 DatagramPacket sender=new DatagramPacket (sendbyte, sendbyte.length, addr, port); server.send (sender); break; break; DNSClient.java import java.io.*; import java.net.*; import java.util.*; class DNSClient public static void main (String args[]) throws Exception DatagramSocket client=new DatagramSocket (); InetAddress addr=inetaddress.getbyname (" "); byte[] sendbyte=new byte[1024]; byte[] receivebyte=new byte[1024]; BufferedReader in=new BufferedReader (new InputStreamReader (System.in)); System.out.println ("Enter domain name:"); String str=in.readline (); sendbyte=str.getbytes (); DatagramPacket sender=new DatagramPacket (sendbyte, sendbyte.length, addr, 1309); client.send (sender); DatagramPacket receiver=new DatagramPacket (receivebyte, sendbyte.length); client.receive (receiver); String s=new String (receiver.getdata ()); System.out.println ("IP ADDRESS or DOMAIN NAME "+s.trim ());
18 SERVER OUTPUT CLIENT
19 SOURCE CODE //MULTIUSER CHAT ChatServer.java import java.io.*; import java.net.*; public class ChatServer public static void main (String args[]) throws Exception int i; String smess, rmess, b="bye"; ServerSocket sersock=new ServerSocket (3000); System.out.println ("Server ready to chat :"); do System.out.println ("Client no :"); DataInputStream din=new DataInputStream (System.in); i=integer.parseint(din.readline()); if (i==0) System.out.println("client" +i+"is connected :"); Socket sock=sersock.accept(); do BufferedReader kread=new BufferedReader (new InputStreamReader (System.in)); OutputStream os=sock.getoutputstream(); PrintWriter pw=new PrintWriter (os, true); InputStream ist=sock.getinputstream(); BufferedReader br=new BufferedReader(new InputStreamReader(ist)); rmess=br.readline(); System.out.println(rmess); smess=kread.readline(); pw.println(smess);
20 System.out.flush(); while((rmess.comparetoignorecase(b))!=0); while(i!=0); ChatClient1.java import java.io.*; import java.net.*; public class ChatClient1 public static void main(string args[]) throws Exception Socket sock=new Socket(" ", 3000); BufferedReader keyread=new BufferedReader(new InputStreamReader(System.in)); OutputStream ostream=sock.getoutputstream(); PrintWriter pwrite=new PrintWriter(ostream, true); InputStream istream=sock.getinputstream(); BufferedReader receivedread=new BufferedReader(new InputStreamReader(istream)); System.out.println("client is ready for chat"); String rmess, smess, b="bye"; do smess=keyread.readline(); pwrite.println(smess); System.out.flush(); rmess=receivedread.readline(); System.out.println(rmess); while(smess.comparetoignorecase(b)!=0);
21 ChatClient2.java import java.io.*; import java.net.*; public class ChatClient2 public static void main(string args[]) throws Exception Socket sock=new Socket(" ", 3000); BufferedReader keyread=new BufferedReader(new InputStreamReader(System.in)); OutputStream ostream=sock.getoutputstream(); PrintWriter pwrite=new PrintWriter(ostream, true); InputStream istream=sock.getinputstream(); BufferedReader receivedread=new BufferedReader(new InputStreamReader(istream)); System.out.println("client is ready for chat"); String rmess, smess, b="bye"; do smess=keyread.readline(); pwrite.println(smess); System.out.flush(); rmess=receivedread.readline(); System.out.println(rmess); while(smess.comparetoignorecase(b)!=0);
22 OUTPUT SERVER CLIENT-1
23 CLIENT-2 ME -Networking Lab
24 SOURCE CODE // #include <stdlib.h> #include <string.h> #define cknull(x) if((x)==null) perror(""); exit(exit_failure); #define cknltz(x) if((x)<0) perror(""); exit(exit_failure); #define LIST_LEN 4 void _it(char *filename); main() char fname[15]; printf("enter the filename\n"); scanf("%s",fname); _it(fname); void _it(char *filename) char tmp[256]=0x0; char fpbuffer[400]=0x0; char _list[list_len][256]="mecse3@localhost.localdomain",0x0; int i=0; for(i=0;* _list[i]>0x0;i++) cknull(strcpy(tmp, _list[i])); cknltz(sprintf (fpbuffer,"mail -s '%s %s' %s < %s","please Review:", filename, tmp, filename)); if(system (fpbuffer)==(-1)) perror(" failure"); exit(exit_failure);
25 OUTPUT Enter the file name: sample.c /home/1me1/dead.letter.saved message in /home/1me1/dead.letter..
26 SOURCE CODE //Download a file using HTTP <html> <title>mca</title> <body background="file:///z:/user/perisonal/images/light%20work.jpg"/><center> <br><br><br><br><br><br><br><br> <blink><font color="#00ff00" size="10"><i>wellcome TO CCET </i></font></blink> <p><font color="blue">your APPLICATION SUBMITED SUCCESFULLY</FONT></P><a href=" CCET</a> <a href="file:///z:/add%20on%20course/html/syll11.docx"> Download File</a> </center> </body> </html>
27 OUTPUT ME -Networking Lab
28 SOURCE CODE //Simulation of Network Management Protocol Manager.java import java.io.*; import java.net.*; public class Manager public static void main(string args[])throws Exception String rmess1, smess, rmess2; int ch=0; Socket sock=new Socket(" ", 3000); BufferedReader keyread=new BufferedReader(new InputStreamReader(System.in)); OutputStream ostream=sock.getoutputstream(); PrintWriter pwrite=new PrintWriter(ostream, true); InputStream istream=sock.getinputstream(); BufferedReader receivedread=new BufferedReader(new InputStreamReader(istream)); System.out.println("Manager\n1.TCP CONNECTION\n2.SYSTEM DETAILS\nEnter your choice:"); ch=integer.parseint(keyread.readline()); if(ch==1) System.out.println("Enter the object ID for client:"); smess=keyread.readline(); pwrite.println(smess); rmess1=receivedread.readline(); System.out.println("The window size of "+smess+" for TCP connection is "+rmess1); else if(ch==2) System.out.println("Enter the object ID for System:"); smess=keyread.readline(); pwrite.println(smess);
29 System.out.flush(); rmess1=receivedread.readline(); rmess2=receivedread.readline(); System.out.println("The manufacturing date for "+smess+" is "+rmess1+"\n The time of last utilization for "+smess+" is "+rmess2); Agent1.java import java.io.*; import java.net.*; public class Agent1 public static void main(string args[])throws Exception String rmess, smess; String oid[]="client1","client2","client3","client4","client5"; String wsize[]="5","10","15","20","25"; ServerSocket sersock=new ServerSocket(3000); Socket sock=sersock.accept(); System.out.println("Agent1:\nAgen1 is ready!!"); OutputStream ostream=sock.getoutputstream(); PrintWriter pwrite=new PrintWriter(ostream, true); InputStream istream=sock.getinputstream(); BufferedReader receivedread=new BufferedReader(new InputStreamReader(istream)); rmess=receivedread.readline(); for(int i=0;i<5;i++) if(rmess.equals(oid[i])) pwrite.println(wsize[i]); break;
30 Agent2.java import java.io.*; import java.net.*; public class Agent2 public static void main(string args[])throws Exception String rmess; String oid[]="system1","system2","system3","system4","system5"; String mdate[]=" "," "," "," "," "; String time[]="9.a.m","10.a.m","11.a.m","10.p.m","12.p.m"; ServerSocket sersock=new ServerSocket(3000); Socket sock=sersock.accept(); System.out.println("Agent2:\n Agent2 is ready!"); OutputStream ostream=sock.getoutputstream(); PrintWriter pwrite=new PrintWriter(ostream, true); InputStream istream=sock.getinputstream(); BufferedReader receivedread=new BufferedReader(new InputStreamReader(istream)); rmess=receivedread.readline(); for(int i=0; i<5; i++) if(rmess.equals(oid[i])) pwrite.println(mdate[i]); pwrite.println(time[i]); break;
31 MANAGER - TCP CONNECTION OUTPUT AGENT 1
32 MANAGER SYSTEM DETAILS AGENT2
CPSC 441 UDP Socket Programming. Department of Computer Science University of Calgary
CPSC 441 UDP Socket Programming Department of Computer Science University of Calgary Socket programming using UDP (vs TCP) UDP: no connection between client and server vno handshaking vsender explicitly
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 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 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 informationCommunication in Distributed Systems: Sockets Programming. Operating Systems
Communication in Distributed Systems: Sockets Programming Operating Systems TCP/IP layers Layers Message Application Transport Internet Network interface Messages (UDP) or Streams (TCP) UDP or TCP packets
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 informationIntroduction to Sockets 9/25/14
Introduction to Sockets 9/25/14 81 Remote communication Inter-process communication is at the heart of all distributed systems Using the network protocol stack on a node is the only way to communicate
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 informationChapter 2 Application Layer
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
More informationChapter 2: outline. 2.1 principles of network applications. 2.6 P2P applications 2.7 socket programming with UDP and TCP
Chapter 2: outline 2.1 principles of network applications app architectures app requirements 2.2 Web and HTTP 2.3 FTP 2.4 electronic mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications 2.7 socket programming
More informationChapter 2 outline. 2.1 Principles of app layer protocols
Chapter 2 outline 2.1 Principles of app layer protocols clients and servers app requirements 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 Socket programming with TCP 2.7 Socket
More informationLecture 3. Java Socket Programming. TCP, UDP and URL
Lecture 3 TCP, UDP and URL 1 Java Sockets Programming The package java.net provides support for sockets programming (and more). Typically you import everything defined in this package with: import java.net.*;
More informationChapter 2 Application Layer
Internet and Intranet Protocols and Applications Lecture 4: Application Layer 3: Socket Programming Spring 2006 Arthur Goldberg Computer Science Department New York University artg@cs.nyu.edu Chapter 2
More informationComputer Networking Introduction
Computer Networking Introduction Halgurd S. Maghdid Software Engineering Department Koya University-Koya, Kurdistan-Iraq Lecture No.6 Chapter 2: outline 2.1 principles of network applications app architectures
More informationLecture 05: Application Layer (Part 02) FTP, Peer-to-Peer, . Dr. Anis Koubaa
NET 331 Computer Networks Lecture 05: Application Layer (Part 02) FTP, Peer-to-Peer, Email Dr. Anis Koubaa Reformatted slides from textbook Computer Networking a top-down appraoch, Fifth Edition by Kurose
More informationLayer 4 - Transport Layer. What do we need a Transport Layer for? Transport Protocols in the TCP/IP Reference Model. The Transport Layer TCP and UDP
Layer 4 - Transport Layer Core of the protocol hierarchy: Network-independent, reliable and economical data transfer Tasks of the transport layer: Connection-oriented or connectionless data transfer Addressing
More informationLayer 4 - Transport Layer
Layer 4 - Transport Layer Core of the protocol hierarchy: Network-independent, reliable and economical data transfer Tasks of the transport layer: Connection-oriented or connectionless data transfer Addressing
More informationProcess Communication COMPUTER NETWORKING Part 2
Process Communication COMPUTER NETWORKING Part 2 Client-server paradigm and Socket Programming ch 18 Thanks to the authors of the textbook [USP] and [KR] for providing the base slides. I made several changes/additions.
More informationComputer Networks. 2.Application Layer. László Böszörményi Computer Networks Application Layer - 1
Computer Networks 2.Application Layer László Böszörményi Computer Networks Application Layer - 1 Applications + App Layer Protocols Applications, app. processes E.g., E-mail, WWW, DNS, P2P file sharing,
More informationComputer Networks Unit II Transport layer (2012 pattern)
Computer Networks Unit II Transport layer (2012 pattern) By Prof. B.A.Khivsara Assistant Prof. Department of Computer Engg. SNJB s KBJ COE, Chandwad Introduction 1-1 Chapter 2: ROAD MAP Transport Layer
More informationUDP Sockets TCP guarantees the delivery of packets and preserves their order on destination. Sometimes these features are not required, since they do
UDP Sockets TCP guarantees the delivery of packets and preserves their order on destination. Sometimes these features are not required, since they do not come without performance costs, it would be better
More informationSE322 Software Design and Architecture
SE322 Software Design and Architecture Middleware Lecture 1 June 30 th, 2011 Pree Thiengburanathum pree.t@cmu.ac.th SE322, Middleware, Pree T. 1 Middleware References Middleware Architecture with Patterns
More informationPart 2: Application Layer
Part 2: Application Layer Our goals: conceptual, implementation aspects of network application protocols client-server paradigm service models learn about protocols by examining popular application-level
More informationCPSC 441 Assignment-3 Discussion. Department of Computer Science University of Calgary
CPSC 441 Assignment-3 Discussion Department of Computer Science University of Calgary Overview of FastFTP protocol TCP for Initial Handshake Port: 2245 Port: 4576 You may choose any free port >1024 at
More informationChapter 2: Application Layer last updated 22/09/03
Chapter 2: Application Layer last updated 22/09/03 Chapter goals: conceptual + implementation aspects of network application protocols client server paradigm service models learn about protocols by examining
More informationJava A.1 TCP/IP TCP. TCP_RO.java import java.net.*; import java.io.*;
II A p.1 A Java C Java TCP/IP TCP/IP A.1 A.1.1 TCP TCP_RO.java public class TCP_RO { public static void main(string[] argv) { Socket readsocket = new Socket(argv[0], Integer.parseInt(argv[1])); InputStream
More informationpublic 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 informationMYcsvtu Notes. Experiment-1. AIM: Write a program to implement fiestal cipher structure PROGRAM: import java.io.*; class functions
Experiment-1 AIM: Write a program to implement fiestal cipher structure PROGRAM: import java.io.*; class functions String Xor(String s1,string s2) char s1array[]=s1.tochararray(); char s2array[]=s2.tochararray();
More informationChapter 2 APPLICATIONS
Chapter 2 APPLICATIONS Distributed Computing Group Computer Networks Summer 2006 Overview Learn specific application layer protocols http, ftp, smtp, pop, dns, etc. How to program network applications?
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 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 informationΠρωτόκολλα Διαδικτύου (ΨΣ-326 DS151)
ΠΑΝΕΠΙΣΤΗΜΙΟ ΠΕΙΡΑΙΩΣ ΤΜΗΜΑ ΨΗΦΙΑΚΩΝ ΣΥΣΤΗΜΑΤΩΝ Πρωτόκολλα Διαδικτύου (ΨΣ-326 DS151) 3 Η ΕΡΓΑΣΤΗΡΙΑΚΗ ΔΙΑΛΕΞΗ (SOCKET PROGRAMMING) Υπεύθυνος καθηγητής: Άγγελος Ρούσκας Βοηθός: Υ.Δ. Ευθύμης Οικονόμου Πέμπτη
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 informationSocket Programming(TCP & UDP) Sanjay Chakraborty
Socket Programming(TCP & UDP) Sanjay Chakraborty Computer network programming involves writing computer programs that enable processes to communicate with each other across a computer network. The endpoint
More informationCPSC 441 Assignment-3 Discussion. Department of Computer Science University of Calgary
CPSC 441 Assignment-3 Discussion Department of Computer Science University of Calgary Overview of FastFTP protocol TCP for Initial Handshake Port: 1111 Port: 4444 UDP for File Content Transfer Port: 3333
More informationCOMP 211 Chapter 2 Application Layer
COMP 211 Chapter 2 Application Layer All material copyright 1996-2012 J.F Kurose and K.W. Ross, All Rights Reserved Computer Networking: A Top Down Approach 7 th edition Jim Kurose, Keith Ross Pearson/Addison
More informationChapter 2 Application Layer
CSB051 Computer Networks 電腦網路 Chapter 2 Application Layer 吳俊興國立高雄大學資訊工程學系 Chapter 2: Outline 2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS
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 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 informationChapter 2 Application Layer
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
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 informationChapter 2 Application Layer
Chapter 2 Application Layer Computer Networking: A Top Down Approach, 4 th edition. Jim Kurose, Keith Ross Addison-Wesley, July 2007. All material copyright 1996-2007 J.F Kurose and K.W. Ross, All Rights
More informationTonight. Communication. Middleware Protocols. Remote Procedure Call (RPC) Several common communication mechanisms RPC RMI Sockets Next week: HTTP,
Tonight Communication Tanenbaum Ch. 4 Distributed Software Systems CS 707 Several common communication mechanisms RPC RMI Sockets Next week: HTTP, Middleware Protocols Remote Procedure Call (RPC) Figure
More informationTelematics Chapter 8: Transport Layer
Telematics Chapter 8: Transport Layer User watching video clip Application Layer Presentation Layer Session Layer Transport Layer Server with video clips Application Layer Presentation Layer Session Layer
More informationChapter 2 Application Layer. 2: Application Layer 1
Chapter 2 Application Layer 2: Application Layer 1 Chapter 2: Application layer 2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications
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 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 informationChapter 2 Application Layer
Chapter 2 Application Layer Prof. Yuh-Shyan Chen Department of Computer Science and Information Engineering National Taipei University March 2007 Computer Networking: A Top Down Approach Featuring the
More informationComputer Networks 1 (Mạng Máy Tính 1) Lectured by: Dr. Phạm Trần Vũ
Computer Networks 1 (Mạng Máy Tính 1) Lectured by: Dr. Phạm Trần Vũ Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009.
More informationChapter 2 Application Layer
Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009. All material copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights
More informationChapter 2 Application Layer
Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009. All material copyright 1996-2009 J.F Kurose and K.W. Ross, All Rights
More informationChapter 2 Application Layer
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
More informationCOMP 3331/9331: Computer Networks and Applications
COMP 3331/9331: Computer Networks and Applications http://www.cse.unsw.edu.au/~cs3331 Week 3 Application Layer: DNS, P2P and Socket Programming Reading Guide: Chapter 2 - Sections 2.5 2.7 Announcements
More informationChapter 2 Application Layer
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
More informationChapter 2 Application Layer
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
More informationChapter 2 Application Layer
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
More informationA note on the use of these ppt slides:
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
More informationChapter 2 Application Layer
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
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 informationData Communications & Networks. Session 2 Main Theme Application Layer. Dr. Jean-Claude Franchitti
Data Communications & Networks Session 2 Main Theme Application Layer Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences Adapted from
More informationData Communications & Networks. Session 2 Main Theme Application Layer. Dr. Jean-Claude Franchitti
Data Communications & Networks Session 2 Main Theme Application Layer Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences Adapted from
More informationCOMPUTER NETWORKS CHAP 2 : APPLICATION LAYER
COMPUTER NETWORKS CHAP 2 : APPLICATION LAYER 0210 8 h 12 h 22 Sep 2011 Chapter 2: Application layer 2 2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail SMTP, POP3, IMAP
More informationJava Networking. Ajay Khatri
Java Networking Ajay Khatri Java Networking Connecting two or more computing devices together so that we can share resources. Advantage of Java Networking Sharing resources Centralize software management
More informationChapter 2: Application layer. Chapter 2 Application Layer. Chapter 2: Application Layer. Some network apps
Chapter 2 Application Layer Computer Networking: A Top Down Approach, 5 th edition. Jim Kurose, Keith Ross Addison-Wesley, April 2009. Chapter 2: Application layer 2.1 Principles of network applications
More informationSoftware Practice 1 - Socket
Software Practice 1 - Socket Terms of socket programming Socket Implementation (TCP, UDP) Socket with multithread Serialization Lab practice Prof. Joonwon Lee T.A. Jaehyun Song Jongseok Kim T.A. Sujin
More informationCSCI Computer Networks Spring 2017
source: computer-networks-webdesign.com CSCI 6760 - Computer Networks Spring 2017 Instructor: Prof. Roberto Perdisci perdisci@cs.uga.edu These slides are adapted from the textbook slides by J.F. Kurose
More informationComputer Networks. Application Layer
Computer Networks Application Layer By: Mohammad Nassiri Bu-Ali Sina University, Hamedan Fall 2009 Chapter 2: Application layer!! 2.1 Principles of network applications!! 2.2 Web and HTTP!! 2.3 FTP!! 2.4
More informationChapter 2 Application Layer
Chapter 2 Application Layer A note on the use of these ppt slides: The notes used in this course are substantially based on powerpoint slides developed and copyrighted by J.F. Kurose and K.W. Ross, 2007
More informationChapter 2: Application layer. Chapter 2 Application Layer. Some network apps. Chapter 2: Application Layer. Chapter 2: Application layer
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
More informationChapter 2: Application layer. Chapter 2 Application Layer. Chapter 2: Application Layer. Some network apps
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
More informationChapter 2a SOCKET PROGRAMMING
Overview Basic concepts Java programming Chapter 2a SOCKET PROGRAMMING Client & server TCP & UDP Threads C programming API details Computer Networks Timothy Roscoe Summer 2007 TCP client and server Asynchronous
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 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 informationChapter 2 Application Layer. 2: Application Layer 1
Chapter 2 Application Layer 2: Application Layer 1 Chapter 2: Application layer 2.1 Principles of network applications 2.2 Web and HTTP 2.3 FTP 2.4 Electronic Mail v SMTP, POP3, IMAP 2.5 DNS 2.6 P2P applications
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 informationAssignment 1. Due date February 6, 2007 at 11pm. It must be submitted using submit command.
Assignment 1 Due date February 6, 2007 at 11pm. It must be submitted using submit command. Note: submit 4213 a1 . Read the manpages ("man submit") for more details on the submit command. It is
More informationChapter 2: Application layer. Computer Networks. Application Layer. Chapter 2: Application Layer. Some network apps. Bu-Ali Sina University, Hamedan
Computer Networks Chapter 2: Application layer Application Layer By: Mohammad Nassiri!! 2.1 Principles of network applications!! 2.2 Web and HTTP!! 2.3 FTP!! 2.4 Electronic Mail!! SMTP, POP3, IMAP!! 2.5
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 information55:134/22C:178 Computer Communications Lecture Note Set 2 Summer 2004
Chapter 2 Application Layer Note: These slides are adapted, with permission, from copyrighted material developed by the authors of Computer Networks, a Top-Down Approach All material copyright 1996-2002
More informationChapter 4: Processes
Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server Systems 4.1 Process Concept An operating
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 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 informationpackage p1; public class Derivation extends Protection { public Derivation() { System.out.println("Derived class constructor");
PROGRAM:1 WAP to implement the packages //package 1: package p1; public class Protection int n=1; public int n_pub=2; private int n_pri=3; protected int n_pro=4; public Protection () System.out.println("Base
More informationWeek 13 Lab - Exploring Connections & Remote Execution
Week 13 Lab - Exploring Connections & Remote Execution COSC244 & TELE202 1 Assessment This lab is worth 0.5%. The marks are awarded for completing the programming exercise and answering the questions.
More informationChapter 2 APPLICATIONS
Overview Distributed Computing Group Chapter 2 APPLICATIONS Computer Networks Summer 2005 Learn specific application layer protocols http, ftp, smtp, pop, dns, etc. How to program network applications?
More informationCPSC 319. Week 2 Java Basics. Xiaoyang Liu & Sorting Algorithms
CPSC 319 Week 2 Java Basics Xiaoyang Liu xiaoyali@ucalgary.ca & Sorting Algorithms Java Basics Variable Declarations Type Size Range boolean 1 bit true, false char 16 bits Unicode characters byte 8 bits
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 informatione) Implicit and Explicit Type Conversion Pg 328 j) Types of errors Pg 371
Class IX HY 2013 Revision Guidelines Page 1 Section A (Power Point) Q1.What is PowerPoint? How are PowerPoint files named? Q2. Describe the 4 different ways of creating a presentation? (2 lines each) Q3.
More informationChapter 12. Network Programming
Chapter 12 Network Programming What is in This Chapter? This chapter explains how to connect your JAVA application to a network. You will learn how to read files from over the internet as well as have
More informationJava Socket Workshop. July Purpose of this workshop:
Java Socket Workshop July 2012 Purpose of this workshop: The objective of this workshop is to gain experience with writing and compiling programs using the Java programming language. The exercises provide
More information/ Download the Khateeb Classes App
Q) Write a program to calculate the factorial of any given integer. import java.io.*; class Data public static void main(string[] args) throws IOException int i,n,f=1; String s = new String(); InputStreamReader
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 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 informationTelematics 1. Chapter 9 Internet Application Layer. Principles of network applications Important application protocols Socket programming
Telematics 1 Chapter 9 Internet Application Layer Principles of network applications Important application protocols Socket programming Acknowledgement: Most of these slides have been prepared by J.F.
More informationCS 10: Problem solving via Object Oriented Programming. Client/Server
CS 10: Problem solving via Object Oriented Programming Client/Server Agenda 1. Sockets 2. Server 3. MulAthreaded server 4. Chat server 2 Sockets are a way for computers to communicate IP: 1.2.3.4 HTTP
More informationChapter 2: Application layer
Chapter 2 Application Layer A note on the use of these ppt slides: We re making these slides freely available to all (faculty, students, readers). They re in PowerPoint form so you can add, modify, and
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 informationComputer Networks and Applications. Application Layer ( , DNS, P2P, Socket Programming)
Computer Networks and Applications COMP 3331/COMP 9331 Week 3 Application Layer (Email, DNS, P2P, Socket Programming) Reading Guide: Chapter 2, Sections 2.4 2.7 Announcements v Lab for Week 3 Socket Programming
More informationUnit 1 Java Networking
Unit 1 Java Networking Q1. What is Server Socket? Discuss the difference between the Socket and ServerSocket class. Ans. The ServerSocket class (java.net) can be used to create a server socket. This object
More informationClient/Server Computing & Socket Programming
CPSC 852 Intering Client/Server Computing & Socket Programming Michele Weigle Department of Computer Science Clemson University mweigle@cs.clemson.edu http://www.cs.clemson.edu/~mweigle/courses/cpsc852
More information