ENCYCLOPEDIA 4U .com



Encyclopedia Home Page

Google
  Web Encyclopedia4u.com

 

Berkeley sockets

The Berkeley sockets application programming interface is a library for developing applications in the C programming language that access a computer network. Berkelet sockets, also known as the BSD socket API originated with the 4.2BSD system (released in 1983) as an API for development of sockets that was covered under the BSD license. It was not until 1989, however, that Berkley was able to release a version of it's operating system and networking library free from the licensing constraints of the Open Group's copyright protected UNIX operating system.

The Berkley socket API is the de facto standard abstraction for network sockets. Most other programing language use a similar interface as the C API.

Table of contents
1 The Header Files
2 The client side
3 The server side
4 Blocking vs. NonBlocking

The Header Files

There are many header files associated with the Berkeley socket development library. They are as follows:
 Definitions for the most basic of socket structures with the BSD socket API
 Basic data types associated with structures within the BSD socket API
 Definitions for the socketaddr_in{} and other base data structures.
 Definitions and data type declarations for SOCK_UNIX streams

The client side

socket()

gethostbyname() and gethostbyaddr()

connect()

The server side

socket()

bind()

listen()

accept()

accept() is used to to satisfy a connection request from a remote host. A specified socket on the local host (which must be capable of accepting the connection) is connected to the requesting socket on the remote host. The remote socket's socket address is returned.

Blocking vs. NonBlocking

Berkley sockets are capable of two modes of operation. A blocking socket will not "return" until all the data has been sent, or received. This may be a problem if a socket is listening, as it may hang a program as the socket waits for data that may never arrive.

See also:

This article was originally based on material from FOLDOC, used with permission. Update as needed.




Content on this web site is provided for informational purposes only. We accept no responsibility for any loss, injury or inconvenience sustained by any person resulting from information published on this site. We encourage you to verify any critical information with the relevant authorities.



Copyright © 2005 Par Web Solutions All Rights reserved.
| Privacy

This article is licensed under the GNU Free Documentation License. It uses material from the Wikipedia article "Berkeley sockets".