Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

localhost and ports

 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hi ranchers ,

what is the range of port numbers can i assign to localhost apart from 8080 ?

suppose i want to install mysql server, glassfish server and oracle server. what about their port numbers do i have to assign different port number for each server OR can i use 8080 for all three server but in that case i can use only one sever application ?
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In theory, all ports from 1 to 65535 can be used. There are some limitations though. For ports from 1 to 1024 you usually need administrative rights; under Linux you need to be root. Furthermore, several ports are already used by the system, like 137 for Windows sharing.

In your case though, MySQL can run on its default port 3306, Oracle on its default 1521 and Glassfish on 8080 without a problem.
 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


what if i want to install apache tomcat after glassfish already at 8080 ? Do i have to assign different port ?

one more que:
how can one know which ports are been used by the system itself ?
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you will need to run Tomcat on another port if Glassfish is already using port 8080.

As for the ports, use the netstat command. You'll need to use the -a flag to see the listening connections. Alternatively, you can use CurrPorts.
 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi bob ,

whe i type netstat -a on command prompt (window xp)

it says : it is not recognized as internal or external command. what is problem here ?
 
Rob Spoor
Sheriff
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No idea, every machine I have worked with has netstat. Try CurrPorts instead.
 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Rob.
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
naveen yadav wrote:hi bob ,

whe i type netstat -a on command prompt (window xp)

it says : it is not recognized as internal or external command. what is problem here ?


I think netstat.exe needs to be available in \WINDOWS\system32
 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Akhilesh Trivedi wrote:I think netstat.exe needs to be available in \WINDOWS\system32


Yes it is available there. But when i execute it flashes for a second or two and then closed automatically.

How can i see its output ?
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
naveen yadav wrote:Yes it is available there. But when i execute it flashes for a second or two and then closed automatically.

How can i see its output ?


Go to start->run type cmd
then try the command.
 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Akhilesh Trivedi wrote:

Go to start->run type cmd
then try the command.



cmd says : it is not recognized as internal or external command
 
Akhilesh Trivedi
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
naveen yadav wrote:
Akhilesh Trivedi wrote:

Go to start->run type cmd
then try the command.



cmd says : it is not recognized as internal or external command




Then go with Rob. Try CurrPorts instead.
 
naveen yadav
Ranch Hand
Posts: 384
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

ya i'll try that out.


thanks Akhilesh.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic