GeekInterview.com
Series: Subject: Topic:
Question: 209 of 222

What is the difference between the socket and pipe?

Asked by: Interview Candidate | Asked on: Feb 27th, 2006
Showing Answers 1 - 7 of 7 Answers
Guest

Answered On : Mar 3rd, 2006

socket and Pipe are all togeather different thinkssocket -It is part of OSI LAYER MODEL.  in Osi model communication between diferrent layer takes places through sockets.say apllication layer provide services trough certain sockets to  presentation layer  and presentation layer uses certain other socket to communicate with upper application layer. socket are used in SECURE SOCKET LAYER NETWORKS pipes- it is realated to  processing of  a process in cpu , pipes are segments of a process in execution.generaly process are divided into distinct segments which are linearly dependent.ie output of first segment become input for next segment and so ongenerally by processing multiple pipes simultaneously ,we can imporve productivity.ie we can run differnt pipe segment simultaneosuly, by keeping in mind ,that they dont indulge  in wainting for each other.

  
Login to rate this answer.
Guest

Answered On : Mar 3rd, 2006

socket and Pipe are all togeather different thinkssocket -It is part of OSI LAYER MODEL.  in Osi model communication between diferrent layer takes places through sockets.say apllication layer provide services trough certain sockets to  presentation layer  and presentation layer uses certain other socket to communicate with upper application layer. socket are used in SECURE SOCKET LAYER NETWORKS pipes- it is realated to  processing of  a process in cpu , pipes are segments of a process in execution.generaly process are divided into distinct segments which are linearly dependent.ie output of first segment become input for next segment and so ongenerally by processing multiple pipes simultaneously ,we can imporve productivity.ie we can run differnt pipe segment simultaneosuly, by keeping in mind ,that they dont indulge  in wainting for each other.                        ABHISHEK TRIPATHI                        M.C.A 4TH SEM                          M.L.S.U, UDAIPUR ,RAJ                EMAIL - abhipounty@yahoo.co.in

  
Login to rate this answer.
Anand

Answered On : Mar 18th, 2006

Socket and Pipes both are the modes of inter process communicationin Linux or UNIX like systems.Socket is used to communicate between network processes..and kernel mediates for that..like for your internet explorer a socket is created and your Device driver(of Modem)communicates to socket for communicationpipes is another mode of bi directonal communication between orocesses

  
Login to rate this answer.
pravin

Answered On : Jul 6th, 2006

Socket: it is logical connection for communication of application or two different system. Socket is given named. Then it is called Port. OS have near about 65536 sockets. (i.e 2 pair, 1 for TCP & other for UDP).  Socket from 0 to 1024 are reserved for OS used. While we can use socket above this in our program, say for socket programming in JAva. Socket that are used by client to communicate with Server are ephermal port (short lived) & are released after their session are over.  This name socket (port) have wellknown with port number, ex. Telnet Server work onTCP port no. 23, TFTP on UDP port 69.Pipe: pipe is use for connection link. This is used for sending and reciving information within OS or application. Output/ Input through pipe can be buffered or cached. ( in processor also there are pipe U & V pipes)

  
Login to rate this answer.
vigrem

Answered On : Jul 26th, 2007

View all answers by vigrem

Pipe is a linear array of bytes, as is a file, but it is used solely as an I/O stream, and it is unidirectional. It also has no name, and thus cannot be opened with open. Instead, it is created by the pipe system call, which returns two descriptors, one of which accepts input that is sent to the other descriptor reliably, without duplication, and in order. The system also supports a named pipe or FIFO. A FIFO has properties identical to a pipe, except that it appears in the filesystem; thus, it can be opened using the open system call. Two processes that wish to communicate each open the FIFO: One opens it for reading, the other for writing.             A socket is a transient object that is used for interprocess communication; it exists only as long as some process holds a descriptor referring to it. A socket is created by the socket system call, which returns a descriptor for it. There are different kinds of sockets that support various communication semantics, such as reliable delivery of data, preservation of message ordering, and preservation of message boundaries.

  
Login to rate this answer.

Pipe is not bi directional communication. pipe is uni directional communication.

  
Login to rate this answer.

Pipe is a special file. Two types of pipes are:unnamed pipesnamed pipes (FIFO)1) Pipe is used for IPC - (Inter Process Communication), whereas socket is used for IPC and also for communication of process in network.2) pipe supports destructive reading (once if you read it vanishes), Socket does not.

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Question Categories

Shell Scripting Interview Questions

Solaris Admin Interview Questions

UNIX Interview Questions

Unix Programming Interview Questions

Windows Interview Questions

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.