Networking and Streams

Servers and Clients

Networking and Streams

Check out a free preview of the full Networking and Streams course

The "Servers and Clients" Lesson is part of the full, Networking and Streams course featured in this preview video. Here's what you'd learn in this lesson:

James talks about a server, which is a computer listening to incoming connections, even if they are coming from local connections. Clients are computers that are initiating connections with a server on the other end.


Transcript from the "Servers and Clients" Lesson

>> We have this idea of a server which is kind of you, should maybe in a lot of cases think of it as a role that a computer system or a computer program can play, is really anytime that you are listening for incoming connections like we're doing with like we just did with Netcat, with dash LP, then that is a server.

So that's one sense of it. So any computer really, that has a networking stack can be a server in different circumstances, even if the only incoming connections are from localhost. This is just kind of how they work. Clients on the other hands are, you can think of those as the computer that's going to initiate that connection.

So, if you wanna make a TCP connection, you've gotta have an address on the network, and you have to have your network card plugged in, or you have to be associated with a wireless access point, that kind of thing. And there has to be a server listening on the other end for incoming connections.

But there's yet another kind of architecture that I'm gonna talk about a bit more tomorrow, and probably also on day four as well, that is called peer to peer. And peer to peer system, you don't really have this kind of client and server role. Everything is both a client and both a server at the same time.

So peers might be listening for incoming connections, but they're also initiating connections to other peers on the network. And it's a little bit trickier to set up this kind of a network, because you have to build things like bootstrapping lists to get the network off the ground. And there's a lot more trickiness, like building a symmetric protocol versus building kind of like a client server protocol that you have to contend with and you also have to contend with well.

There's no like server that you own. So you have to sort of deal with the fact that anyone can kind of do anything that they want and we have to manage that complexity. But these systems can work pretty well. So some big examples of peer to peer protocols would be peer to peer networks like BitTorrent or IPFS.

If you've ever heard of that. Or there's also a web standard called WebRTC, that lets you initiate peer to peer protocol connections from the web browser. So, this is often used for things like video and audio chat, because to run all of the bandwidth to make a connection for audio or video through a central server can get very expensive, and it's also adds more latency.

Then you need to build a direct connection between clients. It's also used, I think for here and there for a couple of games on the web.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now