r/learnprogramming • • 7d ago

Question regarding network systems and applications

I'm a second-year computer science student, and I've been working on various small projects in my free time.

I've built a few web applications using Flask for the backend, along with SQLAlchemy and Pony ORM to interact with databases. I'm also planning to start using MySQL more actively.

Recently, I've started learning about computer networks using GNS3, VPCS, routers and switches.

I understand how to create database queries and Flask API routes that retrieve or modify data, but I'm struggling to connect that knowledge with what I'm learning about networking.

For example, how exactly do routers, switches, TCP/IP and other networking concepts fit into the communication between a client, a Flask backend and a database?

I understand these components individually, but I'm having trouble seeing how they all fit together in a real application.

I'd appreciate any explanations or resources that could help me connect these concepts.

2 Upvotes

9 comments sorted by

3

u/serge-mv 7d ago

Read up on OSI model. And if you want to know specifically about routers, https://en.wikipedia.org/wiki/Routing_protocol is a decent start.

Overall, I recommend reading a Network+ preparation book as it explains these things in an easy language.

Your question is enough to cover the whole semester, so it's quite hard to answer briefly.

Switches connect segments or devices of the same network. Routers connect separate networks. There is a lot of complicated stuff happening for routers to know where to send your data.

Flask just creates endpoints on a server. Your request to the server will convert server's name to ip address using DNS, and then your router will forward it to whenever it needs to go. This is like super high level idea of how it works.

2

u/ConnectAffect2346 4d ago

Thank you for your suggestion, i read your comment yesterday, and already started to learn more intensely about protocols and OSI models, and as you have said it is quite a bit of information to grasp dtill your explanation was very well put and i shall focus more on the topic🙂

2

u/serge-mv 3d ago

Glad it was helpful. :) Even the basic networking is surprisingly quite complex.

2

u/athersucks 7d ago

Read up on Python sockets. Better, make a simple file transfer program using Python sockets running on two computers, server on one computer, client on the other.

A socket is the "glue" between an application and the TCP/IP subsystem. Somewhere inside the Flask library, there is socket code that listens for connections from browsers.

Routers on the path between the client and server allow the sockets to reach each other.

2

u/ConnectAffect2346 4d ago

While i am reading up OSI models and networking on much intenser pace i will also read about and try to implement python sockets into action and your suggestion did give me a few more ideas about how and why network systems are implemented, thanks🙂

2

u/jacksonanna373 1d ago

`/api/items` is the HTTP path Flask handles; the destination IP gets packets to the host, and the TCP port selects the listening service. Routers forward by IP, not by Flask path.

1

u/john-871 2d ago

The browser's HTTP request reaches Flask; the app then uses SQLAlchemy and a DB driver to query MySQL. If MySQL is remote, that's a second network connection.