posted 8 years ago
A Network Port number specifies an area in memory (or "endpoint") that your network interface sends incoming data to. Sometimes I think it's easier to imagine it from a networking perspective. An application can listen on multiple ports. Your application (using a ServerSocket for instance) will look there for data sent over the network to be processed. Only applications using TCP/IP communication use ports. A Network Socket is a "channel" that is the flow of data to a specific thread or process, whereas a port can be a data source for multiple sockets. A socket depends on an IP address and port. For instance, you could be running Tomcat on port 8080 and create a Java Server app listening on port 8080 as well. Sun has a networking tutorial.