File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can we use same port(exp 80) if we use different protocols

 
sam liya
Ranch Hand
Posts: 1240
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to know can we use same port(exp 80) if we use different protocols(HTTP and FTP)
 
Henry Wong
author
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liyanage wrote:i need to know can we use same port(exp 80) if we use different protocols(HTTP and FTP)


When you say "use the same port", do you mean for two applications to try to bind to the same local port? Do you do mean for two applications to try to use the same remote port? Do you mean a single server binding to the same port, but serving two different protocols? Etc. We need a bit of clarification please.

Henry
 
sam liya
Ranch Hand
Posts: 1240
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i found below in JSP & SERVLET book.please explain

using one server app per port,a server can have up to 65536 different server apps running(although it's possible to run more than one app on the same port if the apps use different protocols)
 
Henry Wong
author
Marshal
Pie
Posts: 20836
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sam liyanage wrote:i found below in JSP & SERVLET book.please explain

using one server app per port,a server can have up to 65536 different server apps running(although it's possible to run more than one app on the same port if the apps use different protocols)


I believe that the "protocol" being referred to here is the transport level protocol -- meaning either "TCP" or "UDP".

And yes, it is supposedly possible. Never tried it myself though. If you want to confirm it, it should be straightforward to test -- just create a ServerSocket and a DatagramSocket using the same local bind port.

Henry
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic