Here I will explain how to make a JTextField instance to accept  numbers only (in NetBeans)

Step 1:

Create JFrame instance

Add a JTextField on to it.

Step 2:

2.1 Right Click on JTextField instance

2.2. Select/Click Events Option

2.3 Select Key Option

2.4 Click/Select key Typed Option

Step 3:

Write Following Code therein:

char c=evt.getKeyChar();


Repeat step:1 to step:2.3

Here select:  key Pressed

type the same code as you did in step:3

TextField Validation

TextField Validation

Following steps are followed while using the JDBC in any Java Application:

  1. Import the java.sql.*;  package in your program
  2. Load the appropriate JDBC driver using Class.forName method
  3. Establish a connection to the database using DriverManager class
  4. Create a statement to select/update the data
  5. Execute the statement
  6. Retrieve the results
  7. Close the Connection, Close the statement.


September 18, 2013

Dynamic HTML

The term DHMTL is used for a collection of technologies like HTML, CSS, JavaScript, and DOM. These technologies are used together to develop interactive,responsive and attractive websites.

By using HTML one can create structure of a webpage or User Interface.

CSS is used to design look and feel of a webpage.

JavaScript is used to make a webpage interactive

DOM – Document Object Model is used to specify and used the hierarchy of HTML elements used in a webpage.

Web Designing

Web designing is the process of creating and presenting the contents and structure of a web page.

Difference Between Web Designing & Web Development

Web designing is concerned with the look & feel of a website whereas the web development is concerned with logic used for data handling in the background of a webpage.

Good Web Design

A good web design is that where desirable things are shown on the webpage and undesirable things are removed from the webpage. Still some points are given below to be considered while going for a good web design:

Good things

Background does not interrupt the text
Text is big enough to read, but not too big
The hierarchy of information is perfectly clear
Columns of text are narrower than in a book to make reading easier on the screen
Navigation buttons and bars are easy to understand and use
Navigation is consistent throughout web site
Navigation buttons and bars provide the visitor with a clue as to where they are, what page of the site they are currently on
Frames, if used, are not obtrusive
A large site has an index or site map
Link colors coordinate with page colors
Links are underlined so they are instantly clear to the visitor
Buttons are not big and dorky
Every graphic has an alt label
Every graphic link has a matching text link
Graphics and backgrounds use browser-safe colors
Animated graphics turn off by themselves
General Design
Pages download quickly
First page and home page fit into 800 x 600 pixel space
All of the other pages have the immediate visual impact within 800 x 600 pixels
Good use of graphic elements (photos, subheads, pull quotes) to break up large areas of text
Every web page in the site looks like it belongs to the same site; there are repetitive elements that carry throughout the pages

* * * * * * * * * *

Bad things:

Default gray color
Color combinations of text and background that make the text hard to read
Busy, distracting backgrounds that make the text hard to read
Text that is too small to read
Text crowding against the left edge
Text that stretches all the way across the page
Centered type over flush left body copy
Paragraphs of type in all caps
Paragraphs of type in bold
Paragraphs of type in italic
Paragraphs of type in all caps, bold, and italic all at once
Underlined text that is not a link
Default blue links
Blue link borders around graphics
Links that are not clear about where they will take you
Links in body copy that distract readers and lead them off to remote, useless pages
Text links that are not underlined so you don’t know they are links
..(If you’re not going to underline your links, please make darned sure
..that each link is perfectly clearly a link! Don’t make me wander around
..with my mouse checking to see if randomly colored text is a link!)
Dead links (links that don’t work anymore)
Large graphic files that take forever to load
Meaningless or useless graphics
Thumbnail images that are nearly as large as the full-sized images they link to
Graphics with no alt labels
Missing graphics, especially missing graphics with no alt labels
Graphics that don’t fit on the screen (assuming a screen of 800 x 600 pixels)
Borders turned on in tables
Tables used as design elements, especially with extra large (dorky) borders
Blinking and animations
Anything that blinks, especially text
Multiple things that blink
Rainbow rules (lines)
Rainbow rules that blink or animate
“Under construction” signs, especially of little men working
Animated “under construction” signs
Animated pictures for email
Animations that never stop
Multiple animations that never stop
Counters on pages — who cares
Junky advertising
Having to scroll sideways (800 x 600 pixels)
Too many little pictures of meaningless awards on the first page
Frame scroll bars in the middle of a page
Multiple frame scroll bars in the middle of a page
Unclear navigation; over complex navigation
Complicated frames, too many frames, unnecessary scroll bars in frames
Orphan pages (no links back to where they came from, no identification)
Useless page titles that don’t explain what the page is about
General Design
Entry page or home page that does not fit within standard browser window (800 x 600 pixels)
Frames that make you scroll sideways
No focal point on the page
Too many focal points on the page
Navigation buttons as the only visual interest, especially when they’re large (and dorky)
Cluttered, not enough alignment of elements
Lack of contrast (in color, text, to create hierarchy of information, etc.)
Pages that look okay in one browser but not in another

* * * * * * * * * *

Process of Web Publishing

Web publishing, or “online publishing,” is the process of publishing content on the Internet. It includes creating and uploading websites, updating webpages, and posting blogs online. The published content may include text, images, videos, and other types of media.

In order to publish content on the web, you need three things:

1) web development software,

2) an Internet connection, and

3) a web server.

The software may be a professional web design program like Dreamweaver or a simple web-based interface like WordPress.

The Internet connection serves as the medium for uploading the content to the web server.

Large sites may use a dedicated web host, but many smaller sites often reside on shared servers, which host multiple websites. Most blogs are published on public web servers through a free service like Blogger.

Since web publishing doesn’t require physical materials such as paper and ink, it costs almost nothing to publish content on the web. Therefore, anyone with the three requirements above can be a web publisher. Additionally, the audience is limitless since content posted on the web can be viewed by anyone in the world with an Internet connection. These advantages of web publishing have led to a new era of personal publishing that was not possible before.

 Phases of Web Site development

Six Phases of the Web Site Design and Development Process
There are numerous steps in the web site design and development process. From gathering initial information, to the creation of your web site, and finally to maintenance to keep your web site up to date and current.

Phase One: Information Gathering

The first step in designing a successful web site is to gather information. Many things need to be taken into consideration when we design the look and feel of your site, so we first ask a lot of questions to help us understand your business and your needs in a web site.

Certain things to consider are:

What is the purpose of the site? Do you want to provide information, promote a service, sell a product… ?

What do you hope to accomplish by building this web site? Two of the more common goals are either to make money or share information.

Target Audience
Is there a specific group of people that will help you reach your goals? It is helpful to picture the “ideal” person you want to visit your web site. Consider their age, sex or interests – this will help us determine the best design style for your site.

What kind of information will the target audience be looking for on your site? Are they looking for specific information, a particular product or service…?

Phase Two: Planning
Using the information gathered from phase one, we put together a plan for your web site.

Here we develop a site map – a list of all main topic areas of the site, as well as sub-topics (if applicable). This gives us a guide as to what content will be on the site, and is essential to developing a consistent, easy to understand navigational system. This is also the point where we decide what technologies should be implemented – interactive forms, CMS (content management system) such as WordPress, etc.

Phase Three: Design
Drawing from the information gathered up to this point, we determine the look and feel of the site. Target audience is one of the key factors taken into consideration here. A site aimed at teenagers, for example, will look much different than one meant for a financial institution. We also incorporate elements such as the company logo or colors to help strengthen the identity of your company on the web site.

Once we’ve designed a prototype, you are given access to the Client Studio, which is a secure area of our web site. The Client Studio allows you to view your project throughout the design and development stages. Most importantly, it gives you the opportunity to express your likes and dislikes on the site design.

In this phase, communication is crucial to ensure that the final web site will match your needs and taste. We work together in this way, exchanging ideas, until we arrive at the final design for the site. Then development can begin…

Phase Four: Development
This is where the web site itself is created. We take all of the individual graphic elements from the prototype and use them to create the functional web site. We also take your content and distribute it throughout the site, in the appropriate areas.

This entire time, you will continue to be able to view your site in the Client Studio, and suggest any additional changes or corrections you would like to have done.

Phase Five: Testing and Delivery
At this point, we attend to the final details and test your web site. We test things such as the complete functionality of forms or other scripts, we test for last minute compatibility issues (viewing differences between different web browsers), ensuring that the site is optimized to be viewed properly in the most recent browser versions.

Once we receive your final approval, it is time to deliver the site. We upload the files to your server – in most cases, this also involves installing and configuring WordPress, along with a core set of essential plugins to help enhance the site. Here we quickly test again to make sure that all files have been uploaded correctly, and that the site continues to be fully functional. This marks the official launch of your site, as it is now viewable to the public.

Phase Six: Maintenance
The development of your web site is not necessarily over, though. One way to bring repeat visitors to your site is to offer new content or products on a regular basis. If this interests you, we will be more than happy to continue working together with you to update the information on your web site. We offer maintenance packages at reduced rates, based on how often you anticipate making changes or additions to your site.

Structure of HTML Document

notes for Section – A


September 17, 2013

Java Development Kit

JDK is a bundle of Programming tools, provided by Oracle. JDK has following tools:

  • appletviewer – this tool can be used to run and debug Java applets without a web browser
  • apt – the annotation-processing tool[4]
  • extcheck – a utility which can detect JAR-file conflicts
  • idlj – the IDL-to-Java compiler. This utility generates Java bindings from a given Java IDL file.
  • jabswitch – the Java Access Bridge. Exposes assistive technologies on Microsoft Windows systems.
  • java – the loader for Java applications. This tool is an interpreter and can interpret the class files generated by the javac compiler. Now a single launcher is used for both development and deployment. The old deployment launcher, jre, no longer comes with Sun JDK, and instead it has been replaced by this new java loader.
  • javac – the Java compiler, which converts source code into Java bytecode
  • javadoc – the documentation generator, which automatically generates documentation from source code comments
  • jar – the archiver, which packages related class libraries into a single JAR file. This tool also helps manage JAR files.
  • javafxpackager – tool to package and sign JavaFX applications
  • jarsigner – the jar signing and verification tool
  • javah – the C header and stub generator, used to write native methods
  • javap – the class file disassembler
  • javaws – the Java Web Start launcher for JNLP applications
  • JConsole – Java Monitoring and Management Console
  • jdb – the debugger
  • jhat – Java Heap Analysis Tool (experimental)
  • jinfo – This utility gets configuration information from a running Java process or crash dump. (experimental)
  • jmap – This utility outputs the memory map for Java and can print shared object memory maps or heap memory details of a given process or core dump. (experimental)
  • jmc – Java Mission Control
  • jps – Java Virtual Machine Process Status Tool lists the instrumented HotSpot Java Virtual Machines (JVMs) on the target system. (experimental)
  • jrunscript – Java command-line script shell.
  • jstack – utility which prints Java stack traces of Java threads (experimental)
  • jstat – Java Virtual Machine statistics monitoring tool (experimental)
  • jstatd – jstat daemon (experimental)
  • keytool – tool for manipulating the keystore
  • pack200 – JAR compression tool
  • policytool – the policy creation and management tool, which can determine policy for a Java runtime, specifying which permissions are available for code from various sources
  • VisualVM – visual tool integrating several command-line JDK tools and lightweight[clarification needed] performance and memory profiling capabilities
  • wsimport – generates portable JAX-WS artifacts for invoking a web service.
  • xjc – Part of the Java API for XML Binding (JAXB) API. It accepts an XML schema and generates Java classes.
  • jre – Java Runtime Environment

Confused with JDK & SDK?

Generally the term JDK is used in context of  Java SE and SDK is used in context of Java EE. However, Java EE is available with or without JDK.

Networking Devices

September 14, 2013

Originally taken from


Networks using a Star topology require a central point for the devices to connect. Originally this device was called a concentrator since it consolidated the cable runs from all network devices. The basic form of concentrator is the hub.

hub stackable hub

As shown in Figure; the hub is a hardware device that contains multiple, independent ports that match the cable type of the network. Most common hubs interconnect Category 3 or 5 twisted-pair cable with RJ-45 ends, although Coax BNC and Fiber Optic BNC hubs also exist. The hub is considered the least common denominator in device concentrators. Hubs offer an inexpensive option for transporting data between devices, but hubs don’t offer any form of intelligence. Hubs can be active or passive.

An active hub strengthens and regenerates the incoming signals before sending the data on to its destination.

Passive hubs do nothing with the signal.

Ethernet Hubs

An Ethernet hub is also called a multiport repeater. A repeater is a device that amplifies a signal as it passes through it, to counteract the effects of attenuation. If, for example, you have a thin Ethernet network with a cable segment longer than the prescribed maximum of 185 meters, you can install a repeater at some point in the segment to strengthen the signals and increase the maximum segment length. This type of repeater only has two BNC connectors, and is rarely seen these days.

ethernet hub switch
8 Port mini Ethernet Hub

The hubs used on UTP Ethernet networks are repeaters as well, but they can have many RJ45 ports instead of just two BNC connectors. When data enters the hub through any of its ports, the hub amplifies the signal and transmits it out through all of the other ports. This enables a star network to have a shared medium, even though each computer has its own separate cable. The hub relays every packet transmitted by any computer on the network to all of the other computers, and also amplifies the signals.

The maximum segment length for a UTP cable on an Ethernet network is 100 meters. A segment is defined as the distance between two communicating computers. However, because the hub also functions as a repeater, each of the cables connecting a computer to a hub port can be up to 100 meters long, allowing a segment length of up to 200 meters when one hub is inserted in the network.

Multistation Access Unit


A Multistation Access Unit (MAU) is a special type of hub used for token ring networks. The word “hub” is used most often in relation to Ethernet networks, and MAU only refers to token ring networks. On the outside, the MAU looks like a hub. It connects to multiple network devices, each with a separate cable.

Unlike a hub that uses a logical bus topology over a physical star, the MAU uses a logical ring topology over a physical star.

When the MAU detects a problem with a connection, the ring will beacon. Because it uses a physical star topology, the MAU can easily detect which port the problem exists on and close the port, or “wrap” it. The MAU does actively regenerate signals as it transmits data around the ring.


Switches are a special type of hub that offers an additional layer of intelligence to basic, physical-layer repeater hubs. A switch must be able to read the MAC address of each frame it receives. This information allows switches to repeat incoming data frames only to the computer or computers to which a frame is addressed. This speeds up the network and reduces congestion.

ethernet hub swtich

Switches operate at both the physical layer and the data link layer of the OSI Model.


A bridge is used to join two network segments together, it allows computers on either segment to access resources on the other. They can also be used to divide large networks into smaller segments. Bridges have all the features of repeaters, but can have more nodes, and since the network is divided, there is fewer computers competing for resources on each segment thus improving network performance.


Bridges can also connect networks that run at different speeds, different topologies, or different protocols. But they cannot, join an Ethernet segment with a Token Ring segment, because these use different networking standards. Bridges operate at both the Physical Layer and the MAC sublayer of the Data Link layer. Bridges read the MAC header of each frame to determine on which side of the bridge the destination device is located, the bridge then repeats the transmission to the segment where the device is located.


Routers Are networking devices used to extend or segment networks by forwarding packets from one logical network to another. Routers are most often used in large internetworks that use the TCP/IP protocol suite and for connecting TCP/IP hosts and local area networks (LANs) to the Internet using dedicated leased lines.


Routers work at the network layer (layer 3) of the Open Systems Interconnection (OSI) reference model for networking to move packets between networks using their logical addresses (which, in the case of TCP/IP, are the IP addresses of destination hosts on the network). Because routers operate at a higher OSI level than bridges do, they have better packet-routing and filtering capabilities and greater processing power, which results in routers costing more than bridges.

cisco router

Routing tables

Routers contain internal tables of information called routing tables that keep track of all known network addresses and possible paths throughout the internetwork, along with cost of reaching each network. Routers route packets based on the available paths and their costs, thus taking advantage of redundant paths that can exist in a mesh topology network.

Because routers use destination network addresses of packets, they work only if the configured network protocol is a routable protocol such as TCP/IP or IPX/SPX. This is different from bridges, which are protocol independent. The routing tables are the heart of a router; without them, there’s no way for the router to know where to send the packets it receives.

Unlike bridges and switches, routers cannot compile routing tables from the information in the data packets they process. This is because the routing table contains more detailed information than is found in a data packet, and also because the router needs the information in the table to process the first packets it receives after being activated. A router can’t forward a packet to all possible destinations in the way that a bridge can.

  • Static routers: These must have their routing tables configured manually with all network addresses and paths in the internetwork.
  • Dynamic routers: These automatically create their routing tables by listening to network traffic.
  • Routing tables are the means by which a router selects the fastest or nearest path to the next “hop” on the way to a data packet’s final destination. This process is done through the use of routing metrics.
  • Routing metrics which are the means of determining how much distance or time a packet will require to reach the final destination. Routing metrics are provided in different forms.
  • hop is simply a router that the packet must travel through.
  • Ticks measure the time it takes to traverse a link. Each tick is 1/18 of a second. When the router selects a route based on tick and hop metrics, it chooses the one with the lowest number of ticks first.

You can use routers, to segment a large network, and to connect local area segments to a single network backbone that uses a different physical layer and data link layer standard. They can also be used to connect LAN’s to a WAN’s.


Brouters are a combination of router and bridge. This is a special type of equipment used for networks that can be either bridged or routed, based on the protocols being forwarded. Brouters are complex, fairly expensive pieces of equipment and as such are rarely used.


A Brouter transmits two types of traffic at the exact same time: bridged traffic and routed traffic. For bridged traffic, the Brouter handles the traffic the same way a bridge or switch would, forwarding data based on the physical address of the packet. This makes the bridged traffic fairly fast, but slower than if it were sent directly through a bridge because the Brouter has to determine whether the data packet should be bridged or routed.


A gateway is a device used to connect networks using different protocols. Gateways operate at the network layer of the OSI model. In order to communicate with a host on another network, an IP host must be configured with a route to the destination network. If a configuration route is not found, the host uses the gateway (default IP router) to transmit the traffic to the destination host. The default t gateway is where the IP sends packets that are destined for remote networks. If no default gateway is specified, communication is limited to the local network. Gateways receive data from a network using one type of protocol stack, removes that protocol stack and repackages it with the protocol stack that the other network can use.


  • E-mail gateways-for example, a gateway that receives Simple Mail Transfer Protocol (SMTP) e-mail, translates it into a standard X.400 format, and forwards it to its destination
  • Gateway Service for NetWare (GSNW), which enables a machine running Microsoft Windows NT Server or Windows Server to be a gateway for Windows clients so that they can access file and print resources on a NetWare server
  • Gateways between a Systems Network Architecture (SNA) host and computers on a TCP/IP network, such as the one provided by Microsoft SNA Server
  • A packet assembler/disassembler (PAD) that provides connectivity between a local area network (LAN) and an X.25 packet-switching network

CSU / DSU (Channel Service Unit / Data Service Unit)

A CSU/DSU is a device that combines the functionality of a channel service unit (CSU) and a data service unit (DSU). These devices are used to connect a LAN to a WAN, and they take care of all the translation required to convert a data stream between these two methods of communication.

csu dsu

A DSU provides all the handshaking and error correction required to maintain a connection across a wide area link, similar to a modem. The DSU will accept a serial data stream from a device on the LAN and translate this into a useable data stream for the digital WAN network. It will also take care of converting any inbound data streams from the WAN back to a serial communication.

A CSU is similar to a DSU except it does not have the ability to provide handshaking or error correction. It is strictly an interface between the LAN and the WAN and relies on some other device to provide handshaking and error correction.

NICs (Network Interface Card)

Network Interface Card, or NIC is a hardware card installed in a computer so it can communicate on a network. The network adapter provides one or more ports for the network cable to connect to, and it transmits and receives data onto the network cable.

Wireless Lan card
wireless lan card

Every networked computer must also have a network adapter driver, which controls the network adapter. Each network adapter driver is configured to run with a certain type of network adapter.

Network card

Network Interface Adapter Functions
Network interface adapters perform a variety of functions that are crucial to getting data to and from the computer over the network.

These functions are as follows:

Data encapsulation
The network interface adapter and its driver are responsible for building the frame around the data generated by the network layer protocol, in preparation for transmission. The network interface adapter also reads the contents of incoming frames and passes the data to the appropriate network layer protocol.

Signal encoding and decoding
The network interface adapter implements the physical layer encoding scheme that converts the binary data generated by the network layer-now encapsulated in the frame-into electrical voltages, light pulses, or whatever other signal type the network medium uses, and converts received signals to binary data for use by the network layer.

transmission and reception
The primary function of the network interface adapter is to generate and transmit signals of the appropriate type over the network and to receive incoming signals. The nature of the signals depends on the network medium and the data-link layer protocol. On a typical LAN, every computer receives all of the packets transmitted over the network, and the network interface adapter examines the destination address in each packet, to see if it is intended for that computer. If so, the network interface adapter passes the packet to the computer for processing by the next layer in the protocol stack; if not, the network interface adapter discards the packet.

Data buffering
Network interface adapters transmit and receive data one frame at a time, so they have built-in buffers that enable them to store data arriving either from the computer or from the network until a frame is complete and ready for processing.

Serial/parallel conversion
The communication between the computer and the network interface adapter runs in parallel, that is, either 16 or 32 bits at a time, depending on the bus the adapter uses. Network communications, however, are serial (running one bit at a time), so the network interface adapter is responsible for performing the conversion between the two types of transmissions.

Media access control
The network interface adapter also implements the MAC mechanism that the data-link layer protocol uses to regulate access to the network medium. The nature of the MAC mechanism depends on the protocol used.

Network protocols

A networked computer must also have one or more protocol drivers (sometimes called a transport protocol or just a protocol). The protocol driver works between the upper-level network software and the network adapter to package data to be sent on the network.

In most cases, for two computers to communicate on a network, they must use identical protocols. Sometimes, a computer is configured to use multiple protocols. In this case, two computers need only one protocol in common to communicate. For example, a computer running File and Printer Sharing for Microsoft Networks that uses both NetBEUI and TCP/IP can communicate with computers using only NetBEUI or TCP/IP.

ISDN (Integrated Services Digital Network) adapters

Integrated Services Digital Network adapters can be used to send voice, data, audio, or video over standard telephone cabling. ISDN adapters must be connected directly to a digital telephone network. ISDN adapters are not actually modems, since they neither modulate nor demodulate the digital ISDN signal.

Like standard modems, ISDN adapters are available both as internal devices that connect directly to a computer’s expansion bus and as external devices that connect to one of a computer’s serial or parallel ports. ISDN can provide data throughput rates from 56 Kbps to 1.544 Mbps (using a T1 carrier service).

isdn adpator

ISDN hardware requires a NT (network termination) device, which converts network data signals into the signaling protocols used by ISDN. Some times, the NT interface is included, or integrated, with ISDN adapters and ISDN-compatible routers. In other cases, an NT device separate from the adapter or router must be implemented. ISDN works at the physical, data link, network, and transport layers of the OSI Model.

WAPs (Wireless Access Point)

A wireless network adapter card with a transceiver sometimes called an access point, broadcasts and receives signals to and from the surrounding computers and passes back and forth between the wireless computers and the cabled network.

wireless access point

Access points act as wireless hubs to link multiple wireless NICs into a single subnet. Access points also have at least one fixed Ethernet port to allow the wireless network to be bridged to a traditional wired Ethernet network.


A modem is a device that makes it possible for computers to communicate over telephone lines. The word modem comes from Modulate and Demodulate. Because standard telephone lines use analog signals, and computers digital signals, a sending modem must modulate its digital signals into analog signals. The computers modem on the receiving end must then demodulate the analog signals into digital signals.


Modems can be external, connected to the computers serial port by an RS-232 cable or internal in one of the computers expansion slots. Modems connect to the phone line using standard telephone RJ-11 connectors.

Transceivers (media converters)

Transceiver short for transmitter-receiver, a device that both transmits and receives analog or digital signals. The term is used most frequently to describe the component in local-area networks (LANs) that actually applies signals onto the network wire and detects signals passing through the wire. For many LANs, the transceiver is built into the network interface card (NIC). Some types of networks, however, require an external transceiver.


In Ethernet networks, a transceiver is also called a Medium Access Unit (MAU). Media converters interconnect different cable types twisted pair, fiber, and Thin or thick coax, within an existing network. They are often used to connect newer 100-Mbps, Gigabit Ethernet, or ATM equipment to existing networks, which are generally 10BASE-T, 100BASE-T, or a mixture of both. They can also be used in pairs to insert a fiber segment into copper networks to increase cabling distances and enhance immunity to electromagnetic interference (EMI).


In computing, a firewall is a piece of hardware and/or software which functions in a networked environment to prevent some communications forbidden by the security policy, analogous to the function of firewalls in building construction.


A firewall has the basic task of controlling traffic between different zones of trust. Typical zones of trust include the Internet (a zone with no trust) and an internal network (a zone with high trust). The ultimate goal is to provide controlled connectivity between zones of differing trust levels through the enforcement of a security policy and connectivity model based on the least privilege principle.

There are three basic types of firewalls depending on:

  • whether the communication is being done between a single node and the network, or between two or more networks
  • whether the communication is intercepted at the network layer, or at the application layer
  • whether the communication state is being tracked at the firewall or not

With regard to the scope of filtered communication these firewalls are exist:

  • Personal firewalls, a software application which normally filters traffic entering or leaving a single computer through the Internet.
  • Network firewalls, normally running on a dedicated network device or computer positioned on the boundary of two or more networks or DMZs (demilitarized zones). Such a firewall filters all traffic entering or leaving the connected networks.

In reference to the layers where the traffic can be intercepted, three main categories of firewalls exist:

  • network layer firewalls An example would be iptables.
  • application layer firewalls An example would be TCP Wrapper.
  • application firewalls An example would be restricting ftp services through /etc/ftpaccess file

These network-layer and application-layer types of firewall may overlap, even though the personal firewall does not serve a network; indeed, single systems have implemented both together.

There’s also the notion of application firewalls which are sometimes used during wide area network (WAN) networking on the world-wide web and govern the system software. An extended description would place them lower than application layer firewalls, indeed at the Operating System layer, and could alternately be called operating system firewalls.

Lastly, depending on whether the firewalls track packet states, two additional categories of firewalls exist:

  • stateful firewalls
  • stateless firewalls

Network layer firewalls

Network layer firewalls operate at a (relatively low) level of the TCP/IP protocol stack as IP-packet filters, not allowing packets to pass through the firewall unless they match the rules. The firewall administrator may define the rules; or default built-in rules may apply (as in some inflexible firewall systems).

A more permissive setup could allow any packet to pass the filter as long as it does not match one or more “negative-rules”, or “deny rules”. Today network firewalls are built into most computer operating system and network appliances.

Modern firewalls can filter traffic based on many packet attributes like source IP address, source port, destination IP address or port, destination service like WWW or FTP. They can filter based on protocols, TTL values, netblock of originator, domain name of the source, and many other attributes.

Application-layer firewalls

Application-layer firewalls work on the application level of the TCP/IP stack (i.e., all browser traffic, or all telnet or ftp traffic), and may intercept all packets traveling to or from an application. They block other packets (usually dropping them without acknowledgement to the sender). In principle, application firewalls can prevent all unwanted outside traffic from reaching protected machines.

By inspecting all packets for improper content, firewalls can even prevent the spread of the likes of viruses. In practice, however, this becomes so complex and so difficult to attempt (given the variety of applications and the diversity of content each may allow in its packet traffic) that comprehensive firewall design does not generally attempt this approach.


A proxy device (running either on dedicated hardware or as software on a general-purpose machine) may act as a firewall by responding to input packets (connection requests, for example) in the manner of an application, whilst blocking other packets.

proxy server

Proxies make tampering with an internal system from the external network more difficult, and misuse of one internal system would not necessarily cause a security breach exploitable from outside the firewall (as long as the application proxy remains intact and properly configured). Conversely, intruders may hijack a publicly-reachable system and use it as a proxy for their own purposes; the proxy then masquerades as that system to other internal machines. While use of internal address spaces enhances security, crackers may still employ methods such as IP spoofing to attempt to pass packets to a target network.

PPP & SLIP Protocols

September 14, 2013

PPP and SLIP protocols

The majority of people, not having lines (cable or Ethernet) linked directly to the Internet, must use telephone lines (the most widely used network) to connect to the Internet. The connection is made using a modem, a device capable of converting digital data from the computer into analogue signals (that can circulate on telephone lines by amplitude or frequency modulation, in the same way as voice when you use the telephone).

Considering that only two computers are communicating and the speed of a telephone line is slow in comparison to that of a local network, it is necessary to use a protocol enabling standard communication between the different machines using a modem, and not overload the telephone line. These protocols are called modem protocols.

The notion of a point to point link

Via a standard telephone line, a maximum of two computers can communicate using a modem, in the same way that it is impossible to call two people simultaneously using the same telephone line. This is thus called a point to point link, i.e. a link between two machines reduced to its most simple expression: there is no need to share the line between several machines, each one speaks and responds in turn.

So, many modem protocols have been developed. The first of them allowed a single transmission of data between two machines, then some of them were equipped with error control and with the growth of the Internet, were equipped with the ability to address machines. In this way, there are now two main modem protocols:

· SLIP: an old protocol, low in controls

· PPP: the most widely used protocol for accessing the Internet via a modem, it authorizes addressing machines

The SLIP protocol

SLIP means Serial Line Internet Protocol. SLIP is the result of the integration of modem protocols prior to the suite of TCP/IP protocols.

It is a simple Internet link protocol conducting neither address or error control, this is the reason that it is quickly becoming obsolete in comparison to PPP.

Data transmission with SLIP is very simple: this protocol sends a frame composed only of data to be sent followed by an end of transmission character (the END character, the ASCII code of which is 192). A SLIP frame looks like this:

Data to be transmitted END

The PPP protocol

PPP means Point to Point Protocol. It is a much more developed protocol than SLIP (which is why it is replacing it), insofar as it transfers additional data, better suited to data transmission over the Internet (the addition of data in a frame is mainly due to the increase in bandwidth).

In reality, PPP is a collection of three protocols:

  •  a datagram encapsulation protocol
  •  an LCP, Link Control Protocol, enabling testing and communication configuration
  •  a collection of NCPs, Network Control Protocols allowing integration control of PPP within the protocols of the upper layers

Data encapsulated in a PPP frame is called a packet. These packets are generally datagrams, but can also be different (hence the specific designation of packet instead of datagram). So, one field of the frame is reserved for the type of protocol to which the packet belongs. A PPP frame looks like this:

Protocol (1-2 bytes) Data to be transmitted Padding data

The padding data is used to adapt the length of the frame for certain protocols.

A PPP session (from opening to closure) takes place as follows:

  •  Upon connection, an LCP packet is sent
  •  In the event of an authentication request from the server, a packet relating to an authentication protocol may be sent (PAP, Password Authentication Protocol, or CHAP, Challenge Handshake Authentication Protocol or Kerberos)
  •  Once communication is established, PPP sends configuration information using the NCP protocol
  •  Datagrams to be sent are transmitted as packets
  •  Upon disconnection, an LCP packet is sent to end the session

 More information

For more information on PPP protocol, please refer to RFC1661 which explains the protocol in detail:

  •  RFC 1661

Originally taken from:

//Code for TCP Client Program
public class client
public static void main(String a[])throws IOException
Socket con=new Socket(“localHost”,95);
BufferedReader in=new BufferedReader(new
PrintWriter out=new PrintWriter(con.getOutputStream(),true);
String s1=in.readLine();
System.out.println(“From Server:”+s1);
System.out.print(“Enter the messages to the server:”);
BufferedReader din=new BufferedReader(new
String st=din.readLine();
catch(UnknownHostException e){     }
//Code for TCP Server Program
public class server
public static void main(String a[])throws IOException
ServerSocket s=new ServerSocket(95);
System.out.println(“Server Waiting For The Client”);
Socket cs=s.accept();
InetAddress ia=cs.getInetAddress();
String cli=ia.getHostAddress();
System.out.println(“Connected to the client with IP:”+cli);
BufferedReader in=new BufferedReader(new
PrintWriter out=new PrintWriter(cs.getOutputStream(),true);
BufferedReader din=new BufferedReader(new
System.out.print(“To Client:”);
String tocl=din.readLine();
String st=in.readLine();
System.out.println(“From Client:”+st);
catch(IOException e)     { }
The Output:




Get every new post delivered to your Inbox.

Join 160 other followers

%d bloggers like this: