Skip to main content

Posts

Showing posts from August, 2021

Connection oriented socket programming in java

Write a connection oriented socket program which can exchange the message between server and client once the connection is established. Java Sockets makes networked programming easy. the java.net package offers developers a wide range of tools to create networked applications. the socket class provides the access to a TCP connection between hosts. Unfortunately, it doesn't provide an API for detecting a dropped connection from the remote system. Java sockets can facilitate both TCP and UDP type protocols. While UDP connections are non-persistent, TCP connections often support a dynamic back-and-forth exchange of information between two network end systems. Example of Java Socket Programming (Read and Write from both client and server) //save this code in file name MyOwnServer.java import  java.net.*;   import  java.io.*;   class  MyFirstServer{   ...

Difference between AWT and Swing

 Difference between AWT and Swing Both java AWT and Java Swing are Java API which is used to develop GUI or window-based applications in java. The difference between Java AWT and Java Swing are given below: Note:- Swing is the extension of AWT and not the replacement. AWT Swing 1.    AWT components are platform dependent.     2.    The look and feel of AWT component  vary  from one operating system (OS) to another.   3.    AWT components do not support the facility of pluggable look and feel.   4.     AWT components are heavy weight.    5.    AWT components...

What is Java Swing?

 What is Java Swing?     Java Swing is the java API that can be used to develop more interactive GUI application than AWT in platform independent manner. Swing was added in JDK 1.2 as a part of javax.swing and its subpackages. Swing and JavaBeans allow the GUI builder to write code for you as you place components onto forms using graphical tools. This rapidly speeds development during GUI building, and also allows for greater experimentation and thus the ability to try out more designs and presumably come up with better ones. Java Swing is one of the java library which makes the programming of an application easy  to code. In my opinion the java swing library is easy to learn. Swing is reasonably straight forward, even if you do use a GUI builder rather than coding by hand, the resulting code should still be comprehensible. this solves a big problem with GUI builders used before swing, which could generate unreadable code. Swing is  a ...