Download presentation
Presentation is loading. Please wait.
1
Davide Rossi 2002 Using Sockets in Java
2
2Davide Rossi 2002 TCP/IP A protocol is a set of rules that determine how things communicate with each other The software which manages Internet communication follows a suite of protocols called TCP/IP The Internet Protocol (IP) determines the format of the information as it is transferred The Transmission Control Protocol (TCP) dictates how messages are reassembled and handles lost information
3
3Davide Rossi 2002 IP Internet Protocol: RFC 791 Base protocol for data transmission It is connectionless and unreliable It is routable Defines the addressing of the nodes using IP addresses
4
4Davide Rossi 2002 IP and Internet Addresses Each computer on the Internet has a unique IP address, such as: 130.136.1.110 Most computers also have a unique Internet name, which also is referred to as an Internet address: www.cs.unibo.it The first part indicates a particular computer ( www ) The rest is the domain name, indicating the organization ( cs.unibo.it )
5
5Davide Rossi 2002 TCP Transmission Control Protocol: RFC 793 It’s a reliable connection-oriented protocol Reliability is achieved using packets indexing and generating “ack” messages for each received packet
6
6Davide Rossi 2002 TCP Creating a connection is an asymmetrical process; once the connection is established the protocol becomes symmetric Ports are used to initiate a connection
7
7Davide Rossi 2002 Connection Sequence FTPHTTP POP 2311080 Server Web Browser Client http://my.server.it my.server.it
8
8Davide Rossi 2002 TCP Standard Ports Below 1024, assigned by the IANA 21FTP 23Telnet 80HTTP 110POP3 119NNTP
9
9Davide Rossi 2002 TCP Connections in Java The Socket class is used for handling TCP connections in Java A socket can be used as a data source for a stream The SocketServer class is used to establish a connection
10
10Davide Rossi 2002 Waiting for a Connection ServerSocket ss = new ServerSocket(1234); Socket s = ss.accept();
11
11Davide Rossi 2002 Connecting to a Remote Host Socket s = new Socket(“my.host.it”, 1234);
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.