• Post Reply Bookmark Topic Watch Topic
  • New Topic

Socket and URL's!  RSS feed

 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
To make connection between server and client, I have to use both means Sockets and URL's? Or I can use any of them. What differnce between URL's and Sockets...
Thanks
Angela
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the server supports a protocal that URL recognizes (ftp or http), you can use URL to create a URLConnection to it(which really winds up being a socket connection usually to port 80 for http and port 21 for ftp on the server). It will take care of some of the protocal specific communiction for you.
Sockets can be used at any time. If you use a socket client to contact an http server, you have to handle some of the details that URL already does (like sending a get when you request a page). Using a socket does allow you to handle the communication in your own way if you don't wish to use one of the established protocals.
For more detail check out Custom Networking tutorial
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Carl Trusiak
Thanks a lot! I want to what is port? and how can I know which port number I have to use means whether it is low or high ?
Thanks in advance,
Angela

Originally posted by Carl Trusiak:
If the server supports a protocal that URL recognizes (ftp or http), you can use URL to create a URLConnection to it(which really winds up being a socket connection usually to port 80 for http and port 21 for ftp on the server). It will take care of some of the protocal specific communiction for you.
Sockets can be used at any time. If you use a socket client to contact an http server, you have to handle some of the details that URL already does (like sending a get when you request a page). Using a socket does allow you to handle the communication in your own way if you don't wish to use one of the established protocals.
For more detail check out Custom Networking tutorial

 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps this post can help a little. http://www.javaranch.com/ubb/Forum33/HTML/000974.html
 
Angela Jessi
Ranch Hand
Posts: 428
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Carl,
Thanks a lot!
Regds
Angela
Originally posted by Carl Trusiak:
Perhaps this post can help a little. http://www.javaranch.com/ubb/Forum33/HTML/000974.html

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!