Computer network programming: Difference between revisions

Content deleted Content added
rm tag - please use Talk page to explain which statements you challenge
m Undid edits by 87.251.25.103 (talk) to last version by AnnaBSP
 
(102 intermediate revisions by 74 users not shown)
Line 1:
{{Short description|Writing computer programs with networking capability}}
'''Computer network programming''' involves writing [[computer programs]] that enable [[process (computing)|processes]] to communicate with each other across a [[computer network]].
{{one source|date=June 2013}}
 
{{For|similar terms referring to the hardware technologies committed to computer network programming |Computer network}}
== Network programming is client-server programming ==
 
'''Computer network programming''' involves writing [[computer programs]] that enable [[process (computing)|processes]] to communicate with each other across a [[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>
{{main|client-server model}}
 
== Connection-oriented and connectionless communications ==
[[Interprocess communication]], even if it is bidirectional, cannot be implemented in a perfectly symmetric way: to establish a communication channel between two process, one process must take the initiative, while the other is waiting for it. Therefore, network programming unavoidably assumes a [[client-server model]]: The process initiating the communication is a [[client (computing)|client]], and the process waiting for the communication to be initiated is a [[Server (computing)|server]]. The client and server processes together form a [[distributed system]]. In a [[peer-to-peer]] communication, the program can act both as a client and a server.
 
Very generally, most of communications can be divided into [[Connection-oriented_communication|connection-oriented]], and [[Connectionless_communication|connectionless]]. Whether a communication is connection-oriented or connectionless, is defined by the [[Communications_protocol|communication protocol]], and not by {{nowr|[[application programming interface]] (API)}}. Examples of the connection-oriented protocols include {{nowr|[[Transmission Control Protocol]] (TCP)}} and {{nowr|[[Sequenced Packet Exchange]] (SPX)}}, and examples of connectionless protocols include {{nowr|[[User Datagram Protocol]] (UDP)}}, "raw IP", and {{nowr|[[Internetwork Packet Exchange]] (IPX)}}.
== Network programming is socket programming ==
 
== Clients and servers ==
{{main|Network socket}}
{{main|client-serverclient–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_(computing)|server]]". Another party is the one which initiates connection; this party is usually referred to as "[[Client_(computing)|client]]".
The endpoint in an interprocess communication is called a socket, or a [[network socket]] for disambiguation. Since most communication between computers is based on the Internet Protocol, an almost equivalent term is ''Internet socket''. The data transmission between two sockets is organised by [[communications protocol]]s, usually implemented in the operating system of the participating computers. Application programs write to and read from these sockets. Therefore, network programming is essentially socket programming.
 
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 [[Network_packet|packet]] to "server".
=== Standard API ===
 
== Popular protocols and APIs ==
{{main|Berkeley socket}}
 
Network programming traditionally covers different layers of [[OSI_model|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.
The reference [[application programming interface]] for socket programming is the [[Berkeley sockets|Berkeley (or BSD) sockets API]], first introduced in 1983, which has evolved into a [[POSIX]] standard. Application programs create, control, and use sockets through system calls like <code>socket()</code>, <code>bind()</code>, <code>listen()</code>, <code>connect()</code>, <code>send()</code>, <code>recv()</code>.
 
{| class="wikitable"
==Further Reading==
! OSI/ISO Layer
! Protocol
! API
|-
| L3 (network)
| [[Internet Protocol|IP]]
| [[Raw socket]]
|-
| L4 (transport)
| [[Transmission Control Protocol|TCP]], [[User Datagram Protocol|UDP]], [[Stream Control Transmission Protocol |SCTP]]
| [[Berkeley Sockets]]
|-
| L5 (session)
| [[Transport Layer Security|TLS]]
| [[OpenSSL]]
|-
| L7 (application)
| [[HTTP]]
| Various
|}
 
== See also ==
* W. Richard Stevens: UNIX Network Programming, Volume 1, Second Edition: Networking APIs: Sockets and XTI, Prentice Hall, 1998, ISBN 0-13-490012-X.
 
* [[Software-defined networking]]
[[Category:Computer networks]]
*[[Infrastructure as code]]
* [[Site reliability engineering]]
* [[DevOps]]
 
== References ==
* W. Richard Stevens: '''[[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]]
 
[[mk:Computer network programming]]
[[ru:Программирование сетевых задач]]