• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why we use socket programming

 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to know what is the advantage of using Socket programming as there are other protocols above it(HTTP,TCP....)?
 
Steve Kedzie
Greenhorn
Posts: 22
BSD Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam,

First off, socket programming is not a protocol and is necessary for network programming. In a nutshell, protocols such as HTTP, TCP, UDP, ect - would not have a means to "communicate" without socket programming. Basically, socket programming provides the logical interface that protocols use for sending and receiving data over a network. This link will take you to Oracle's socket tutorial:

http://docs.oracle.com/javase/tutorial/networking/sockets/

I hope the above link helps you gain a deeper understanding of sockets programming in Java. Good luck!

Steve
 
sam liya
Ranch Hand
Posts: 1240
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TCP protocol is not above sockets. The socket API allows you to communicate using TCP. From a programmers POV, socket programming IS TCP
 
Henry Wong
author
Marshal
Pie
Posts: 21003
77
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jayesh A Lalwani wrote:TCP protocol is not above sockets. The socket API allows you to communicate using TCP. From a programmers POV, socket programming IS TCP


Just for completion only. The other protocol that sockets supports is UDP. See the DatagramSocket class for sending/reveiving UDP on a unicast address, and MulticastSocket for sending/receiving on a multicast group.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic