A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.

Slides:



Advertisements
Similar presentations
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 25 Networking.
Advertisements

1 Java Networking – Part I CS , Spring 2008/9.
1 L53 Networking (2). 2 OBJECTIVES In this chapter you will learn:  To understand Java networking with URLs, sockets and datagrams.  To implement Java.
Universidad de Chile - Tupper 2007, Santiago - Fono/Fax: (56 2) cec.uchile.cl Módulo ECI - 11: Fundamentos de Redes de Computadores.
System Programming Practical session 10 Java sockets.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L24 (Chapter 25) Networking.
An Introduction to Internetworking. Why distributed systems - Share resources (devices & CPU) - Communicate people (by transmitting data)
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L22 (Chapter 25) Networking.
© Lethbridge/Laganière 2001 Chap. 3: Basing Development on Reusable Technology 1 Let’s get started. Let’s start by selecting an architecture from among.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 25 Networking.
WXES2106 Network Technology Semester /2005 Chapter 8 Intermediate TCP CCNA2: Module 10.
An Introduction to Internetworking. Algorithm for client-server communication with UDP (connectionless) A SERVER A CLIENT Create a server-socket (listener)and.
Aalborg Media Lab 15-Jul-15 Java & EyesWeb Lecture 14 Java Client / Server Communication.
CEG3185 Tutorial 4 Prepared by Zhenxia Zhang Revised by Jiying Zhao (2015w)
19-Aug-15 About the Chat program. 2 Constraints You can't have two programs (or two copies of the same program) listen to the same port on the same machine.
By: Joel Rodriguez.  International student from Mexico  Delicias, Chihuahua Mexico  Spanish  Sports and Music.
Socket Programming References: redKlyde ’ s tutorial set Winsock2 for games (gamedev.net)
Assignment 3 A Client/Server Application: Chatroom.
TCP/IP protocols Communication over Internet is mostly TCP/IP (Transmission Control Protocol over Internet Protocol) TCP/IP "stack" is software which allows.
University of Pittsburgh Computer Science 1 Week 5: Introduction Last week we discussedLast week we discussed èDifference between executing sequentially.
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
Lecture 2 TCP/IP Protocol Suite Reference: TCP/IP Protocol Suite, 4 th Edition (chapter 2) 1.
PA3: Router Junxian (Jim) Huang EECS 489 W11 /
Jozef Goetz, Application Layer PART VI Jozef Goetz, Position of application layer The application layer enables the user, whether human.
1 CSC111H Client-Server: An Introduction Dennis Burford
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 26.

Establishing communication with Envirobat using TCP/IP Presented by Apourva Parthasarathy Date : 18/06/13.
 TCP (Transport Control Protocol) is a connection-oriented protocol that provides a reliable flow of data between two computers.  TCP/IP Stack Application.
RGEC MEERUT(IWT CS703) 1 Java Networking RGEC Meerut.
Practicum: - Client-Server Computing in Java Fundamental Data Structures and Algorithms Margaret Reid-Miller 13 April 2004.
1. I NTRODUCTION TO N ETWORKS Network programming is surprisingly easy in Java ◦ Most of the classes relevant to network programming are in the java.net.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
© Lethbridge/Laganière 2005 Chap. 3: Basing Development on Reusable Technology The Client-Server Architecture A distributed system is a system in.
1 Chapter 28 Networking. 2 Objectives F To comprehend socket-based communication in Java (§28.2). F To understand client/server computing (§28.2). F To.
1 Network Programming and Java Sockets. 2 Network Request Result a client, a server, and network Client Server Client machine Server machine Elements.
Sockets Sockets A socket is an object that encapsulates a TCP/IP connection There is a socket on both ends of a connection, the client side and the server.
TCP Sockets Reliable Communication. TCP As mentioned before, TCP sits on top of other layers (IP, hardware) and implements Reliability In-order delivery.
Java Sockets Tutorial Rahul Malik Nov 12, 2005.
Prepared by: Azara Prakash L.. Contents:-  Data Transmission  Introduction  Socket Description  Data Flow Diagram  Module Design Specification.
CSC 480 Software Engineering Socket. What is Socket? A socket is one end-point of a two-way communication link between two programs running on the network.
Field Trip #25 Creating a Client/Server By Keith Lynn.
Socket Programming Introduction. Socket Definition A network socket is one endpoint in a two-way communication flow between two programs running over.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
Socket Programming.
CSI 3125, Preliminaries, page 1 Networking. CSI 3125, Preliminaries, page 2 Networking A network represents interconnection of computers that is capable.
Prepared by Dr. Jiying Zhao University of Ottawa Canada.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
Java Networking I IS Outline  Quiz #3  Network architecture  Protocols  Sockets  Server Sockets  Multi-threaded Servers.
A Local Area Network Chat Client ITTC LAN CHAT John Vincent Cecogo Jerikho Daguno Ardee Santos Elaine Mendoza Anjomar Pat Del Mindo Philip John Sales Philip.
SOCKET PROGRAMMING WITH JAVA By Collin Donaldson.
Java’s networking capabilities are declared by the classes and interfaces of package java.net, through which Java offers stream-based communications that.
1 Network Communications A Brief Introduction. 2 Network Communications.
1 K. Salah Application Layer Module K. Salah Network layer duties.
LAN Chat server BY: VIPUL GUPTA VIKESH SINGH SUKHDEEP SINGH.
Network Programming. These days almost all devices.
School of Engineering and Computer Science Victoria University of Wellington Copyright: Peter Andreae david streader, VUW Echo Networking COMP
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 33 Networking.
The Echo Server Problem. Contents  Basic Networking Concepts  The Echo Server Problem.
Introduction To Application Layer
Echo Networking COMP
Networking COMP
MCA – 405 Elective –I (A) Java Programming & Technology
Network Layer The network layer is responsible for the source-to-destination delivery of a packet, possibly across multiple networks (links). Whereas the.
An Introduction to Internetworking
Computer Networks Protocols
Message Passing Systems Version 2
Exceptions and networking
Presentation transcript:

A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT

NETWORKING BASICS Transmission Control Protocol (TCP) This protocol ensures that the data sent over two points in a Network is received in the same order as it is sent Ports Is an address which determines the data origin and delivery points over the Network Sockets A socket is one end point of a two way communication link between two programs running on the Network

THE JAVA.net PACKAGE The java.net package is used as the basis for this project. It provides two classes: Socket Server Socket The Socket class implements the client side of the connection and the Server Socket Implements the server side of the connection On the server side: Normally a server runs on a specific computer and has a socket bound to a specific port number. The server just waits, listening to the socket for a client to make a connection request On the client side: The client knows the host name of the machine on which the server is running and the port number to which the server is connected. To make a connection request, the client tries to communicate with the server on the server’s machine and port. Server Port Client Port connection

THE FINAL SOURCE CODE Supporting Multiple Clients Client connection requests are queued at the port, so the server must accept the Connections sequentially. However, the server can service them simultaneously Through the use of threads – One thread per client connection Basic Flow of Logic in such a server is: while(true) { accept a connection; create a thread to deal with the client; } end while A Brief Description of the various files in the source code Server Section: 1. ClientList The client list class creates a client list object which stores a list of output streams connected to individual clients. 2.Session This class creates a session object which listens to the client for messages. It keeps listening until it receives a “Connect” Message. Currently, once the session receives a “Connect” message, it generates a new message saying that user has logged on The first thing a session object does is add the output stream which leads to the client into the client list object. This means that any Input sent from any client will be redirected through the whole list.

3.Server: The Server Class creates a server object, instantiates a new server listener, opens a new server socket, launches a new thread and listens to it. Whenever a new client connects, the server object creates a new session object for the client and goes back to listening. Client Section: 1.Client: The Client object opens a socket to the server and creates a user interface for the user Once everything has been initialized it launches a ClientListener object (running on a Separate thread) which listens to the server and informs the client when new text Arrives. The client object then waits for an action event, and sends any text typed by The user back to the server. 2. Message: This is a simple class which describes a message passed between a server and a client 3. ClientListener: This class creates a new thread which listens to the server for any messages and passes them Back to the client. THANK YOU