java - What is the difference between port and localport? -


this question has answer here:

when print object of socket class in java, prints socket details this-- socket[addr=/127.0.0.1,port=49989,localport=10].i know port number.but don't understand why 2 port numbers(port , localport) there ?

as per javadocs

localport - local port socket bound to, or 0 system selected free port.

for other process port number 49989, process using port 10.

imagine telephone call, number ring 49989, telephone number 10


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -