aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes localhost and ports Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "localhost and ports" Watch "localhost and ports" New topic
Author

localhost and ports

naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384


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

Joined: Oct 27, 2005
Posts: 19692
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384



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

Joined: Oct 27, 2005
Posts: 19692
    
  20

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

Joined: Oct 23, 2011
Posts: 384

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

Joined: Oct 27, 2005
Posts: 19692
    
  20

No idea, every machine I have worked with has netstat. Try CurrPorts instead.
naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384

thanks Rob.
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1526
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


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
naveen yadav
Ranch Hand

Joined: Oct 23, 2011
Posts: 384

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

Joined: Jun 22, 2005
Posts: 1526
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

Joined: Oct 23, 2011
Posts: 384

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

Joined: Jun 22, 2005
Posts: 1526
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

Joined: Oct 23, 2011
Posts: 384


ya i'll try that out.


thanks Akhilesh.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: localhost and ports