EmbLogic's Blog

Brief description about sockets attributes

Sockets are characterized by three attributes:  domain, type and protocol.

syntax:

#include<sys/types.h>

#include<sys/socket.h>

 

int socket(int domain, int type , int protocol);

  • socket domains: domain basically describes the network medium that is used by the sockets for communication. the most common domain used is AF_INET,  for Internet networking and AF_UNIX for UNIX file system domain used on a single  computer that isn’t networked.
  • socket types: In sockets, there are two methods for transferring data: stream and datagrams. stream sockets: It provides a connection link between the client and the server process.It is specified by the type SOCK_STREAM. datagrams: It provides the connectionless link between the client and server process. It is specified by the type SOCK_DGRAM.
  • socket protocols: protocols depends on the type of socket used. If socket type is SOCK_STREAM then TCP/IP protocol is used. If the socket type is SOCK_DGRAM then UDP/IP protocol is used.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>