Successfully reported this slideshow.

Client server chat application

8

Share

Loading in …3
×
1 of 15
1 of 15

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Client server chat application

  1. 1. CLIENT-SERVER CHAT APPLICATION By Piyush Rawat PC Technology Pvt. Ltd.
  2. 2. Networking Basics • Transmission Control Protocol (TCP) • Port • Socket
  3. 3. TCP • This protocol ensures that the data sent over two points in a Network is received in the same order as it is sent. This is ensured by receiving acknowledgements from the receiver side for every packet sent.
  4. 4. PORTS • It is an address which determines the data origin and delivery points over the Network. It is not a hardware device, but a logical construct that identifies a service or process.
  5. 5. SOCKET • A socket is one endpoint of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent to.
  6. 6. Server Working • The server is based on multithreading concept, which runs a separate thread for each client connected to it. • ServerSocket ss = new ServerSocket(3300); // a server socket is created try { while (true) { new Handler(ss.accept()).start(); } } • The server is Broadcast type i.e. it allows the messages from one client to be sent to other client and vice-versa.
  7. 7. Client Working • The client requests connection to the server at a given port and IP address. • ip= getServerAddress(); //server address is received by user s = new Socket(ip, 3300); //new socket is created at particular IP and port • Client is working on simple concept of creating new socket and then sending and receiving messages • Request of clients are placed in a cue for server to resolve.
  8. 8. Classes and packages used • Server side: • javax.swing This package is dealing in providing user interface, i.e. panels, scroll, text fields, etc. • java.io This package provides input/output facilities i.e. readers, writers, etc. • java.net This package provides network related facilities like creating server sockets, accepting connections, etc. • java.util This package provides hashsets used for storing and updating objects of DataOutputStream and name of different client connected to server.
  9. 9. Continued.. • Client side: • javax.swing Here also package is dealing in providing user interface, i.e. panels, scroll, text fields, buttons, etc. • java.io This package provides input/output facilities i.e. readers, writers, etc. • java.net This package provides network related facilities like requesting server for connections, sending and receiving messages, etc. • java.util This package provides hashsets used for storing and updating objects of DataOutputStream and name of different client connected to server.
  10. 10. Final Implementation Asking for IP address of server.
  11. 11. Asking for screen name
  12. 12. When user leaves
  13. 13. Scope • Can be used for private chat over LAN and over Internet*. • Can be further developed for file transfer. • Can be used for broadcasting notices in an organization. • Secure and reliable. • Can also be used as a backup if there is sudden breakdown of internet connection. • Simple and effective with low memory and resource usage. • No dedicated server is required if the application is used for Local Area Network(LAN) i.e. any PC can become server. • Basically this application can be for communication purpose anywhere. *For over the internet connection a dedicated server with global IP will be required.
  14. 14. QUESTIONS ?
  15. 15. Thank you

×