# Computer network programming

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Computer_network_programming
> Markdown URL: https://mediated.wiki/source/Computer_network_programming.md
> Source: https://en.wikipedia.org/wiki/Computer_network_programming
> Source revision: 1289390205
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Writing computer programs with networking capability}}
{{one source|date=June 2013}}

{{For|similar terms referring to the hardware technologies committed to computer network programming |Computer network}}

'''Computer network programming''' involves writing [computer programs](/source/computer_programs) that enable [processes](/source/process_(computing)) to communicate with each other across a [computer network](/source/computer_network).<ref>{{cite book| url=http://people.scs.carleton.ca/~lanthier/teaching/COMP1406/Notes/COMP1406_Ch12_NetworkProgramming.pdf | archive-url=https://web.archive.org/web/20200305163115/http://people.scs.carleton.ca/~lanthier/teaching/COMP1406/Notes/COMP1406_Ch12_NetworkProgramming.pdf | url-status=dead | archive-date=2020-03-05 | chapter=Chapter 12 - Network Programming | date=2017 | quote=Network Programming involves writing programs that communicate with other programs across a computer network. | title=COMP1406  }}</ref>

== Connection-oriented and connectionless communications ==

Very generally, most of communications can be divided into [connection-oriented](/source/Connection-oriented_communication), and [connectionless](/source/Connectionless_communication). Whether a communication is connection-oriented or connectionless, is defined by the [communication protocol](/source/Communications_protocol), and not by {{nowr|[application programming interface](/source/application_programming_interface) (API)}}. Examples of the connection-oriented protocols include {{nowr|[Transmission Control Protocol](/source/Transmission_Control_Protocol) (TCP)}} and {{nowr|[Sequenced Packet Exchange](/source/Sequenced_Packet_Exchange) (SPX)}}, and examples of connectionless protocols include {{nowr|[User Datagram Protocol](/source/User_Datagram_Protocol) (UDP)}}, "raw IP", and {{nowr|[Internetwork Packet Exchange](/source/Internetwork_Packet_Exchange) (IPX)}}.

== Clients and servers ==
{{main|client–server model}}

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](/source/Server_(computing))". Another party is the one which initiates connection; this party is usually referred to as "[client](/source/Client_(computing))".

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](/source/Network_packet) to "server".

== Popular protocols and APIs ==

Network programming traditionally covers different layers of [OSI/ISO model](/source/OSI_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.

{| class="wikitable"
! OSI/ISO Layer 
! Protocol
! API
|-
| L3 (network)
| [IP](/source/Internet_Protocol)
| [Raw socket](/source/Raw_socket)
|-
| L4 (transport)
| [TCP](/source/Transmission_Control_Protocol), [UDP](/source/User_Datagram_Protocol), [SCTP](/source/Stream_Control_Transmission_Protocol)
| [Berkeley Sockets](/source/Berkeley_Sockets)
|-
| L5 (session)
| [TLS](/source/Transport_Layer_Security)
| [OpenSSL](/source/OpenSSL)
|-
| L7 (application)
| [HTTP](/source/HTTP)
| Various
|}

== See also ==

* [Software-defined networking](/source/Software-defined_networking)
*[Infrastructure as code](/source/Infrastructure_as_code)
* [Site reliability engineering](/source/Site_reliability_engineering)
* [DevOps](/source/DevOps)

== References ==
* W. Richard Stevens: '''[UNIX Network Programming](/source/UNIX_Network_Programming)''', Volume 1, Second Edition: Networking APIs: Sockets and XTI, Prentice Hall, 1998, {{ISBN|0-13-490012-X}}

{{reflist}}
Category:Computer networks engineering
Category:Computer programming
Category:Inter-process communication

---
Adapted from the Wikipedia article [Computer network programming](https://en.wikipedia.org/wiki/Computer_network_programming) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Computer_network_programming?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
