Skip to main content

Posts

Showing posts from March, 2023

TRANSMISSION MEDIA

TRANSMISSION MEDIA TRANSMISSION MEDIA: A transmission medium can be broadly defined as anything that can carry information from a source to a destination. For example, the transmission medium for two people having a dinner conversation is the air. The air can also be used to convey the message in a smoke signal or semaphore. For a written message, the transmission medium might be a mail carrier, a truck, or an airplane. In data communications, the definition of the information and the transmission medium is more specific. The transmission medium is usually free space, metallic cable, or fiber-optic cable. The information is usually a signal that is the result of a conversion of data from another form. * Guided Media: Guided media, which are those that provide a conduit from one device to another, including twisted-pair cable, coaxial cable, and fiber-optic cable. A signal traveling along any of these media is directed and contained by the physical limits of the medium. Twisted-pair a

Implement a ping server program using TCP socket

Implement a ping server program using a TCP socket Server-side import java.net.*; import java.io.*; import java.net.SocketException; import java.util.*; import java.lang.*; class pingtcpserver { public static void main(String args[]) throws Exception { ServerSockets=null; Socketsoc=null; String smsg=""; PrintWriter pw; try { s=new ServerSocket(5219); System.out.println("Connecting with client ....... "); soc=s.accept(); System.out.println("Connection Established"); BufferedReader brin=new BufferedReader(new InputStreamReader(soc.getInputStream())); for(int i=0;i<5;i++) { pw=new PrintWriter(soc.getOutputStream(),true); smsg=brin.readLine(); if(i==3) Thread.sleep(100); pw.println(smsg); }} catch(SocketException e) { System.out.println(e); } finally { s.close(); soc.close(); }}} Client-side import java.io.*; import java.net.*; import java.net.SocketException; import java.util.*; class pingtcpclient { public static void main(String args[]) throws Exception

Implement a file server to transfer a file from server side to client side.

Implement a file server to transfer a file from server side to client side. Server-side import java.net.*; import java.io.*; public class ftpserv { public static void main(String args[]) throws Exception { ServerSocketss = null; Socket s = null; try { ss = new ServerSocket(4000); System.out.println("Connecting with client"); s = ss.accept(); System.out.println("Connection is successful"); BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream())); String str = br.readLine( ); BufferedReader br2= new BufferedReader(new FileReader(str) ); System.out.println("File found"); // keeping output stream ready to send the contents PrintWriter pw = new PrintWriter(s.getOutputStream(), true); String str2; while((str2 = br2.readLine()) != null) // reading line-by-line from file { pw.println(str2); // sending each line to client } System.out.println("File send successfully"); } catch (SocketException e) { System.out.println(e);} catch (F

Implement Chat server and client using TCP Sockets

Implement Chat server and client using TCP Sockets Chat Server: import java.io.*; import java.net.*; public class Server { public static void main(String arg[]) { ServerSocket srv=null; DataInputStream fromClient; PrintStream toClient; BufferedReader out; Socket clnt=null; String str1,str2; try { srv=new ServerSocket(9999); } catch(IOException e1) { System.out.println(e1); } try { clnt=srv.accept(); fromClient=new DataInputStream(clnt.getInputStream()); toClient=new PrintStream(clnt.getOutputStream()); out=new BufferedReader(new InputStreamReader(System.in)); toClient.println("Welcome"); while(true) { str1=fromClient.readLine(); if(str1.equals("exit")) System.exit(0); System.out.println("Client: "+str1); System.out.print("Server: "); str2=out.readLine(); toClient.println(str2); }} catch(IOException e2) { System.out.println(e2); }}} Chat Client: import java.io.*; import java.net.*; public class Client { public static void main(String arg[]) { Sock

Implement Echo client and Echo server using TCP Sockets

Implement Echo client and Echo server using TCP Sockets EchoServer.java import java.net.*; import java.io.*; public class EServer { public static void main(String args[]) { ServerSocket s=null; String line; DataInputStream is; PrintStream ps; Socket c=null; try { s=new ServerSocket(9000); } catch(IOException e) {} try { System.out.println(e); c=s.accept(); is=new DataInputStream(c.getInputStream()); ps=new PrintStream(c.getOutputStream()); while(true) { line=is.readLine(); ps.println(line); }} catch(IOException e) { System.out.println(e); }}} EchoClient.java import java.net.*; import java.io.*; public class EClient { public static void main(String arg[]) { Socket c=null; String line; DataInputStream is,is1; PrintStream os; try { InetAddress ia = InetAddress.getLocalHost(); c=new Socket(ia,9000); } catch(IOException e) {} try { System.out.println(e); os=new PrintStream(c.getOutputStream()); is=new DataInputStream(System.in); is1=new DataInputStream(c.getInputStream()); while(true) { Sys

Implement socket programming date and time display from client to server using TCP Sockets

Implement socket programming date and time display from client to server using TCP Sockets DateServer.java: import java.net.*; import java.io.*; import java.util.*; class dateserver { public static void main(String args[]) { ServerSocket ss; Socket s; PrintStream ps; DataInputStream dis; String inet; try { ss=new ServerSocket(8020); while(true) { s=ss.accept(); ps=new PrintStream(s.getOutputStream()); Date d=new Date(); ps.println(d); dis=new DataInputStream(s.getInputStream()); inet=dis.readLine(); System.out.println("THE CLIENT SYSTEM ADDRESS IS :"+inet); ps.close(); }} catch(IOException e) { System.out.println("The exception is :"+e); }}} DateClient.java: import java.net.*; import java.io.*; class dateclient { public static void main (String args[]) { Socket soc; DataInputStream dis; String sdate; PrintStream ps; try { InetAddress ia=InetAddress.getLocalHost(); soc=new Socket(ia,8020); dis=new DataInputStream(soc.getInputStream()); sdate=dis.readLine(); System.ou

What is the monitor? How many types and what is it? Details about CRT, LCD and LED monitors.

मॉनिटर क्या है? कितने प्रकार का होता है और क्या होता है? सीआरटी, एलसीडी और एलईडी मॉनिटर के बारे में विवरण। मॉनिटर क्या है? = मॉनिटर वह पार्ट्स है जो कंप्यूटर सिस्टम के साथ टीवी जैसा दिखता है। मॉनिटर कंप्यूटर सिस्टम का एक बहुत ही महत्वपूर्ण आउटपुट डिवाइस है। इसे डिस्प्ले डिवाइस के नाम से भी जाना जाता है। कंप्यूटर पर हम जो भी कार्य करते हैं उन्हें इस मॉनिटर के माध्यम से देखा जा सकता है, इसलिए मॉनिटर को विजुअल डिस्प्ले यूनिट कहा जाता है। मॉनिटर अलग-अलग साइज में आते हैं जैसे- 14 इंच, 15 इंच, 17 इंच, 19 इंच आदि। (Image by - Google Images) मॉनिटर कितने प्रकार के होते हैं? = रंग प्रदर्शन के आधार पर मॉनिटर्स को दो श्रेणियों में विभाजित किया जा सकता है। 1) मोनोक्रोम मॉनिटर (Monochrome Monitor), 2) कलर मॉनिटर (Color Monitor) । *  वर्तमान में मोनोक्रोम मॉनिटर का उपयोग शायद ही ध्यान देने योग्य है। अब हर जगह कलर मॉनिटर का इस्तेमाल किया जाता है। 1) मोनोक्रोम मॉनिटर (Monochrome Monitor) = इस प्रकार का मॉनिटर केवल सादा-काला चित्र प्रदर्शित करता है। वर्तमान में मोनोक्रोम मॉनिटर बहुत कम उपयोग होता हैं।