# Network Communication in C#: an overview

Programs talk to each other by sending messages over a network, even when both run on the same computer. Your C# app already does this with SQL Server; a browser does it with a web app.

Novice · Web Development · Updated November 3, 2026

## After this lesson you can

- Explain why one program talks to another over a network, even on the same computer

## Key takeaways

- Each program runs in its own sandbox, so to get another program's data it sends a message and waits for an answer.
- The program that asks is the client, and the one that answers is the server. One program can be both.
- Messages travel over a network, using agreed rules called protocols, even when both programs are on the same computer.

Many programs need to work with other programs. The app you wrote in *Connecting Apps to SQL Server* is one: your C# program asked **SQL Server** for rows, and SQL Server sent them back.

## Every program has its own space

Each program on a computer runs in its own **sandbox**: the operating system keeps one program from reaching into another's memory. That's what lets the others carry on when one crashes.

So a program can't simply read another program's data. It has to **send it a message** and wait for an answer. The other program has to be **listening** for messages, or nobody answers.

## The network carries the messages

Those messages travel over a **network**, using agreed rules called **protocols**. The two programs can be on the same computer, or on two computers on opposite sides of the world: as long as they're connected, the messages get through. It's like one program phoning the other.

| The program that asks | The program that answers | What they send |
|---|---|---|
| Your C# app | SQL Server | SQL queries one way, rows the other |
| A web browser | A web app | Requests for pages one way, HTML the other |
| An Angular app (later in the course) | A Web API | Requests for data one way, JSON the other |

The program that asks is the **client**, and the one that answers is the **server**. The same program can be both: in this chapter you'll build a web app that is a server to the browser and, at the same time, a client of SQL Server.

## Check yourself

1 question to try on the lesson page.

## So what

Everything you build from here on is programs passing messages: a browser to your web app, your web app to its database. Knowing who asks and who answers makes the next lessons, on addresses, ports and requests, fall into place.

## Key terms

- [Client and Server](https://www.ask-codey.com/glossary/client-and-server)
- [Protocol](https://www.ask-codey.com/glossary/protocol-web-development)

## Cheat sheets

- [Network Communication, IP Addresses and Ports](https://www.ask-codey.com/cheat-sheets/network-communication-in-csharp-an-overview-cheat-sheet)

Source: https://www.ask-codey.com/lessons/network-communication-in-csharp-an-overview
