1 / 12

CHAT APPLICATION

Sockets. The server waits, listening to the socket for a client to make a connection requestThe client knows the hostname of the machine on which the server is running and the port number to which the server is connectedThe server accepts the connection. The server gets a new socket bound to a dif

barr
Download Presentation

CHAT APPLICATION

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. CHAT APPLICATION This presentation was based on work of the Mexican students in our laboratory Sockets Multicast Chat Connection of two applications

    2. Sockets The server waits, listening to the socket for a client to make a connection request The client knows the hostname of the machine on which the server is running and the port number to which the server is connected The server accepts the connection. The server gets a new socket bound to a different port. It needs a new socket (and consequently a different port number) so that it can continue to listen to the original socket for connection requests while tending to the needs of the connected client. 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. 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.

    3. On the client side, if the connection is accepted, a socket is successfully created and the client can use the socket to communicate with the server The client and server can now communicate by writing to or reading from their sockets

    4. Steps Open a socket. Server try { serverSocket = new ServerSocket(4444); } catch (IOException e) { … Client Socket clientSocket = null; try { clientSocket = serverSocket.accept(); } catch (IOException e) {

    5. Open an input stream and output stream to the socket. PrintWriter out = new PrintWriter( clientSocket.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader( clientSocket.getInputStream())); Read from and write to the stream . out.println(text); in.readLine() Close the streams. Close the socket. out.close(); in.close(); clientSocket.close(); serverSocket.close();

    6. Network Hosts (chat users) connected to each router Link state data is obtained from pings

    7. Dijkstra’s Algorithm with Chat

    9. Arrives a new member

    10. Apor - Jutas

    11. Levedi arrives

    12. Between two chat applications Protocol to communicate the two applications

More Related