Jump to content

Computer network programming

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Ipsign (talk | contribs) at 13:00, 1 December 2015 (Trying to introduce some sense and structure here. Network programming is not only sockets, it also includes higher-level stuff such as TLS and HTTP etc. LOTS of further work is still necessary). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Computer network programming involves writing computer programs that enable processes to communicate with each other across a computer network.

Connection-oriented and connectionless communications

Very generally, most of communications can be divided into connection-oriented, and connectionless. Whether a communication is a connection-oriented, or connectionless, is defined by the communication protocol, and not by API. Examples of the connection-oriented protocols include TCP and SPX, and examples of connectionless protocols include UDP, "raw IP", and IPX.

Clients and servers

For connection-oriented communications, communication parties usually have different roles. One party is usually waiting for incoming connections; this party is usually referred to as "server". Another party is the one which initiates connection; this party is usually referred to as "client".

For connectionless communications, one party ("server") is usually waiting for an incoming packet, and another party ("client") is usually understood as the one which sends an unsolicited packet to "server".

Network programming traditionally covers different layers of OSI/ISO model (most of application-level programming belongs to L4 and up). The table below contains some examples of popular protocols belonging to different OSI/ISO layers, and popular APIs for them.

OSI/ISO Layer Protocol API
L4 (transport) TCP, UDP Berkeley Sockets
L5 (session) TLS OpenSSL
L7 (application) HTTP Various

References

  • W. Richard Stevens: UNIX Network Programming, Volume 1, Second Edition: Networking APIs: Sockets and XTI, Prentice Hall, 1998, ISBN 0-13-490012-X