Learn something new every day
More Info... by email
"Socket C" is a term that sometimes is used to refer to the process of writing socket code in the C programming language and sometimes is used to refer to the actual library file that holds the implementation for some socket functions. The actual socket C library file contains implementations for different functions and macros that provide the basic socket functionality supplied by the language libraries, although the socket C file is operating-system-dependent and might not be implemented on some systems. Writing socket C code involves creating an interface with a standard input and output protocol, known as a socket, and using it to send or receive information, usually over a network or through a piece of hardware. The C programming language is intended to be portable, but socket programming relies on some low-level system specific functions, so it sometimes can be difficult to write programs in C that use sockets but also maintain cross-system portability.
There are three basic types of sockets that socket C supports. The first is known as a datagram, the second is a stream, and the third is raw access. A datagram is a type of socket that sends information in small bundles known as packets. Each packet is sent from a source with information on the destination socket it is seeking across a network. While a datagram can be an efficient method of communicating through sockets and often is used to send email, it also is lossy, because no packet that is sent is guaranteed to arrive at the destination socket.
A stream socket makes a connection to another socket and information is passed directly between the sockets. When used in socket C programming, this type of socket ensures that all data that are sent are received on the other side. One complication, however, is that the socket sometimes can use blocking, meaning the socket will stop execution of a process until information is received or until the socket is closed, although using threads or forked processes can resolve this issue in most instances. Raw socket access is provided as a means of actually interfacing on a nearly hardware level with whatever device is hosting the socket.
Sockets commonly are used in various forms for Internet communications. The hardware and drivers that allow networking to occur vary greatly by operating system, so it can be difficult to locate a socket C library file that supports all possible combinations. For this reason, the socket C file itself, as well as the socket header file, often contains a long list of conditional compilation directives so it will compile differently on various systems.
One of our editors will review your suggestion and make changes if warranted. Note that depending on the number of suggestions we receive, this can take anywhere from a few hours to a few days. Thank you for helping to improve wiseGEEK!