Тёмный

Networking in C++ Part #1: MMO Client/Server, ASIO & Framework Basics 

javidx9
Подписаться 318 тыс.
Просмотров 548 тыс.
50% 1

Опубликовано:

 

30 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 927   
@javidx9
@javidx9 4 года назад
For all those unconvinced it can work, please download and try the prototype project here! onelonecoder.itch.io/meaningless-cog
@Zaneris
@Zaneris 4 года назад
Decided to provide some tea for this quality content ;) Keep up the good work.
@javidx9
@javidx9 4 года назад
Thank you Zaneris! Much appreciated!
@javidx9
@javidx9 4 года назад
Yeah asio comes with ssl objects you can use to negotiate https. A bit too complex for a simple introduction 😁
@Ryan-xq3kl
@Ryan-xq3kl 4 года назад
Ive always been interested in building a mmo project over a long period of time. Is it possible to use this method for high concurrency on a 3D client?
@huberthancock2661
@huberthancock2661 4 года назад
thanks for all the work you do! as someone learning c++, you are truly helpful thank you
@comment1652
@comment1652 4 года назад
I have no idea what i'm watching, but thank you bearded man for the knowledge.
@javidx9
@javidx9 4 года назад
Best comment ever XD
@mattmurphy1065
@mattmurphy1065 3 года назад
I work in IT, and the only thing I understood was the networking lol
@soundbreaker2485
@soundbreaker2485 3 года назад
HTTPS changed the strings being sent in plain text though
@williamgomez6087
@williamgomez6087 3 года назад
You have to see "Hands on Machine Learning whit python"...
@devhonk1722
@devhonk1722 3 года назад
@@LockeIProd and that does not count from 1 lmao
@filmcase1683
@filmcase1683 4 года назад
This man will always be the person I go to for difficult c++ programs
@superscatboy
@superscatboy 4 года назад
It's a real shame he refuses to use modern C++ idioms and techniques.
@qx-jd9mh
@qx-jd9mh 4 года назад
@@superscatboy Cniles are set in their ways
@superscatboy
@superscatboy 4 года назад
@@qx-jd9mh True. I've never understood why though, it's not exactly hard to keep up with the evolution of the language - it progresses at a glacial rate after all.
@qx-jd9mh
@qx-jd9mh 4 года назад
@@superscatboy Imagine not using RAII, smart pointers, l/r values/move semantics, lambdas, auto/delctype, default/deleted functions, initializer lists, strongly typed enums, static assertions, constexpr, or variadic templates/folding expressions. You had plenty of time to learn OO design patterns with C++03 and before. I guess people who learned systems programming with C don't want to learn higher level abstractions.
@swapode
@swapode 4 года назад
​@@superscatboy Well, the best modern C++ idiom in most cases probably is to ditch it for Rust ;-)
@motbus3
@motbus3 4 года назад
Stop and realize for one moment how great the content OLC has been posting. Really amazing.
@Spawnova
@Spawnova 3 года назад
For anyone else who's zip file did not match his, he made a small mistake at 3:04 and seemed to imply to download the boost_asio file, but in fact you want the non boost file.
@crazypeter113
@crazypeter113 3 года назад
still how can i make my vs work with that?
@welcomereality924
@welcomereality924 3 года назад
@@crazypeter113 check the properties files vscode creates, there must be some sort of parameter for includes iirc
@sketburd9360
@sketburd9360 3 года назад
this ^^^
@The_Nelliel
@The_Nelliel 3 года назад
Thank you, omg lol I was getting pissed lol
@ajaydalal199
@ajaydalal199 Год назад
thanks bro, you saved me a lot of time and headache.
@sterdot
@sterdot 4 года назад
Coming from a music production background, I was very confused by ASIO in the title...
@javidx9
@javidx9 4 года назад
Lol yes, its quite an unfortunate coincidence!
@ВячеславЗамулов
@ВячеславЗамулов 4 года назад
@@javidx9 I wish there were more tutorials on Steinberg's ASIO, lol
@user-yr1uq1qe6y
@user-yr1uq1qe6y 4 года назад
I thought the exact same thing when I saw the title come up.
@lucadavidian5441
@lucadavidian5441 4 года назад
Me too!
@foamyrocks665
@foamyrocks665 4 года назад
Me too. They aren't related? I thought the ASIO audio drivers are based on the concepts shown here from the ASIO library.
@DidYouCropThat
@DidYouCropThat 4 года назад
I'm a web developer, but always love to see the other side of programming and especially channels that produce advanced materials, not always the "Hello, world" examples. Thank you for doing this.
@caareystore5058
@caareystore5058 Год назад
this video is explanation of how web works under the hood.
@mattbrewerton6884
@mattbrewerton6884 3 года назад
I can't keep away from these videos. I've watched and listened to so many of them. I don't use C++.
@robrick9361
@robrick9361 3 месяца назад
C++ is for people who like to find problems for their solutions.
@ahaquer153
@ahaquer153 4 года назад
I don't think I've ever clicked on a video faster
@filmcase1683
@filmcase1683 4 года назад
I know, right?
@pwnrz8684
@pwnrz8684 4 года назад
@@filmcase1683 MAIAMAIAMIAMAIAMIAMAIMAIMAIAMIAMAIMA
@TheDubleyaC
@TheDubleyaC 4 года назад
For real, I don't think I'd be interested in any other channel posting a video with this title/description. However, here it's a 100% must watch.
@bruno_kid_
@bruno_kid_ 4 года назад
[2]
@johnbrodie9815
@johnbrodie9815 4 года назад
same my dude
@trobinsoon
@trobinsoon 3 года назад
It took me a while to work it out so for those of you with an error that looks something like "undefined reference to `pthread_join`" (I'm on linux by the way). I fixed it by using - pthread in the compiling command: g++ Main.cpp -I [insert include directory] -o Main -pthread Hope this helps (:
@leftofzen
@leftofzen Год назад
If you're using modern c++, why use std::vector instead of std::vector ?
@SourceCodeDeleted
@SourceCodeDeleted 4 года назад
I am really interested to see this !!! Much needed !!!
@Zaneris
@Zaneris 4 года назад
Socket/networking tutorials are horrible for the most part with addressing how you should design it for real world applications. So happy this is being covered.
@stewartzayat7526
@stewartzayat7526 4 года назад
Your user name gives me anxiety
@SourceCodeDeleted
@SourceCodeDeleted 4 года назад
@@stewartzayat7526 Not the first time I have heard this))
@deleater
@deleater 3 года назад
@@SourceCodeDeleted you make me want to create another account named "Executable Reverse Engineered" lol.
@241lolololol
@241lolololol 3 года назад
Hey javid, Sorry if this was already asked but is ASIO something youd program with for commercial purposes?
@javidx9
@javidx9 3 года назад
I would and have.
@NoxaDreshar
@NoxaDreshar 3 года назад
Coder with 10 years of experience here but in other languages such as C# etc. Learning about C++ now and I gotta say your videos are on a very high technical level and you go through them step by step which I really appreciate. Great quality stuff, keep going. Also highly respect your professional skill level - it kinda makes me feel like a dumbass xD
@harveythe8053
@harveythe8053 3 года назад
@javidx9 Im getting an error from asio::io_context context saying that it has asio has no memeber? ive triple checked the install and made sure its linked properly and it all checks out, pretty frustrating! Any ideas?
@persoulrpg
@persoulrpg 4 года назад
Golden content, yet it's free. Appreciate it people :-)
@doommaker4000
@doommaker4000 3 года назад
@Rusty Boomerton We know
@Klayperson
@Klayperson 3 года назад
windows: go to a website, download a zip file, extract it somewhere, set up your project files to include them... linux: hehe `pacman -S asio` go brrrr
@samuelcampbell6559
@samuelcampbell6559 3 года назад
"Oh no _not Boost_"... I laughed out loud.
@selami32
@selami32 4 года назад
i dont have enough IQ to understanding these courses so i watch these when i need to sleep
@southernkatrina8161
@southernkatrina8161 4 года назад
And ASIO is Australia's government spy network. Australian Security Intelligence Organisation....
@re.liable
@re.liable 4 года назад
Holy sh- same lol
@mihapetek3418
@mihapetek3418 3 года назад
@@southernkatrina8161 ASIO is also music production program...
@unlikelysalmon786
@unlikelysalmon786 3 года назад
@@southernkatrina8161 ASIO is also 4/5ths of a calculator
@ASCENDANTGAMERSAGE
@ASCENDANTGAMERSAGE 3 года назад
I bet you are smart enough, just not interested. Which is a-okay. :) His voice is very soothing even for those of us who do watch for the content.
@HitAndMissLab
@HitAndMissLab 4 года назад
Thank you for the phenomenal video! + Thank you for not assuming that viewers already know what you know + Thank you for explaining things slowly, one small step at a time. That's the best method.
@javidx9
@javidx9 4 года назад
Hey thanks buddy! It's a formula that works.
@RoryBecker
@RoryBecker Год назад
Everything on this channel is Gold. If I'm not interested in it right now, I'm certain I will be at some point. Great content... Delivered well... With just the right level of detail... at the perfect pace.
@joidshgoi5435
@joidshgoi5435 3 года назад
For anyone following along with clion + mingw + cmak, be sure to add if(MINGW) target_link_libraries(learning_asio ws2_32) endif() to your CMakeLists.txt. Otherwise you'll get a bunch of "undefined reference to xxx..." errors when trying to compile around 9:00 mark.
@Олександр-ъ2р
@Олександр-ъ2р Год назад
*only on windows
@ppb2374
@ppb2374 День назад
讲得真好,谢谢老师!以前复制示例,一知半解,也能用,今天听了老师的讲解豁然开朗!
@youtissoum
@youtissoum 3 года назад
anyone know how to fix the problem of std::scoped_lock not begin defined in the tsqueue
@javidx9
@javidx9 3 года назад
Sure, enable c++17 for your compiler
@youtissoum
@youtissoum 3 года назад
​@@javidx9 how do you enable it (i'm using vs 2019)
@javidx9
@javidx9 3 года назад
@@youtissoum project properties, language standard, c++17
@youtissoum
@youtissoum 3 года назад
@@javidx9 thanks it dont give me errors anymore
@conatcha
@conatcha 3 года назад
Thanx for your awesome crystal explanations! That is SOOO great and useful. 46:27 Does make any sense that you use std::move() with a const variable in the push functions though? 55:02 Calling .release() on a unique_ptr would relinquish the inner C pointer! Maybe you wanted to use .reset() instead to release the memory?
@herrdingenz6295
@herrdingenz6295 3 года назад
@conatcha it doesn't make any sense to use std::move on a const object (especially not in combination with emplace_back) i had a debate with javidx9 1 or 2 months ago about this issue and he basically told me to "f*ck off" take a look at Jason Turner's C++ weekly episode about emplace_back and push_back ;)
@conatcha
@conatcha 3 года назад
@@herrdingenz6295 F'ng YT is randomly deleting my comments, I don't know why. In my previous message I said thank you fo your answer and that I was sorry to read that you couldn't get to any conclusion with the channel's owner.
@herrdingenz6295
@herrdingenz6295 3 года назад
@@conatcha i read your previous post .. and yes - YT is randomly deleting comments
@MarcoBergamin
@MarcoBergamin 4 года назад
Really great video! Some suggestions/notes: In net_message.h - use is_trivially_copiable instead of is_standard_layout to check if a datatype can be safely "memcopied" In net_tsqueue.h - make muxQueue mutable add the 'const' keyword to the methods where applicable. - fix push_front and push_back because you are moving a const T& which can't be moved (maybe add push_front(T&&) and push_back(&&) methods for this) - (just to increase the portability) use std::lock_guard instead of std::scoped_lock In net_connection.h - when deriving from std::enable_shared_from_this it is best practice to make the ctor private and add a factory method to create an shared_ptr of that class to be sure you can always call the method shared_from_this without having undefined behaviour or an exception, depending on the c++ version In general, I have noticed you always declare the destructor; be aware that when you declare the dtor, the move ctor and move assignment operator are deleted by default and you have to define them again so maybe defining them again could be a good idea.
@femboy.owo7
@femboy.owo7 Год назад
thanks for the tips dude!
@wizardy6267
@wizardy6267 3 года назад
Thanks for the video, lots of useful stuff. One minor thing @ 55:04, m_connection.release() is used here. The release has a return value to return a raw pointer from the unique pointer which is not really used here. Maybe the reset() is good enough for destroying the connection? And I think the video is missing few seconds about adding Send() interface into client_interface.
@khatdubell
@khatdubell 4 года назад
Minor nit: I think you called it a template function. Its function template.
@YariRu
@YariRu 2 года назад
I watched a lot of teaching videos in my life. Really a lot. But this one, it's the best of all. I like the language, intonation, and speaker's face, all of it brings live to the whole video. I'm impressed.
@DegradationDomain_stuff
@DegradationDomain_stuff 3 года назад
debOOger - for when you need to remove your boogers overcUm the problem - every time
@bongumsamamba5146
@bongumsamamba5146 4 года назад
this dude makes everything looks simple
@drel9300
@drel9300 4 года назад
Thanks a lot for making this video and that is incredibly helpful! However, I have some questions on the static_assert regarding the trivially copyable types (around 35:00 in the video). The first question is that since you mentioned "trivially copyable", I assumed that "is_trivially_copyable" trait should be used to enforce memcpy-safety, but why is "is_standard_layout" used instead in this case? The second question is that when you do the serialization/deserialization for data transmitted between different machines, how can we make sure the sizeof(header) or the bitwise representation of the custom data is the same on different platforms with the same code, given that the same structs may have different alignments and paddings? Although in the example you gave I guess a struct containing two uint32_t should generally be packed densely into a 64 bit chunk, I am worried that different compilers may treat other types of POD structs with different bit representation. Thanks!
@IAintGotNoBody111111
@IAintGotNoBody111111 4 года назад
You are using threads for non-blocking communication. Does ASIO contain some way not to use threads like a portable version of the linux system call "select" ? imho using threads complicates the code and makes you create thread-safe data structures (like the queue) which not only adds overhead but can lead to deadlocks/starvation in bigger projects if not well coded. I am a bit frustrated seeing you using threads and closures. Of course your use of closures here is rigorous and will potentialy not get you in trouble, but I see multiple problems with using them. One of them is the use after free problem we see too many times with cpp closures. Anyway your video is very interesting for understanding how to think about and create a framework :)
@bruno_kid_
@bruno_kid_ 4 года назад
thanks a lot for sharing this content. Info like this is very ward to find, and the majorit times people discourage another developers to do this because it is "hard" or saying "you will never gona do this in you entirely life, do only platform games, cya"
@wickster8384
@wickster8384 4 года назад
This!
@Stehocke
@Stehocke 3 года назад
Thank you for the video. Unfortunatly, I cannot create the asio::io_context variable: "asio has no member io_context". The code till 7:16 min comprising the asio::error_code compiles. So, I looked into the external dependencies io_context.hpp file and there are several compiler errors. Did you make further setting within the project settings of visual studio? Btw despite your explaination, your folder structure of asio looks more like the non-boost version (i downloaded both).
@TheKluxi1
@TheKluxi1 4 года назад
hello
@giorgioguglielmone6528
@giorgioguglielmone6528 2 года назад
Would it be possible to use wxWidgets and Boost Asio together to create an Asynchronous Client, using Visual Studio C ++ 2022?
@neuro5261
@neuro5261 4 года назад
3:03 he mistakenly says "boost asio" and hovers over boost_asio_1_18_0.zip Just to clear up confusion it is just asio-1.18.0.zip
@wizardy6267
@wizardy6267 4 года назад
He means it. if ppl downloaded the non-boost version. The `#define ASIO_STANDALONE` is not required anymore.
@neuro5261
@neuro5261 4 года назад
​@@wizardy6267 Writing #define ASIO_STANDALONE would make sense if he downloaded boost asio but he didn't. At 3:39 is his file "asio-1.18.zip" and not "boost_asio_1_18_0.zip" ?
@wizardy6267
@wizardy6267 4 года назад
@@neuro5261 I didn't pay attention to 3:39. But I used the asio-1.18. When I tried to build. The compiler complained the macro `ASIO_STANDALONE` redefined in the library. Since he still has the macro defined. I guess either the warning is suppressed or he is using the boost version. Or maybe the 3:39 is the mistaken spot. :p
@sirgouki6207
@sirgouki6207 4 года назад
@@wizardy6267 I don't get that warning with mine, and I'm using the non-boost version. With the boost version, even with standalone set, I was still having to tell it to use boost::asio:: instead of asio::
@baardi2
@baardi2 4 года назад
@javid9x 55:05 I think you meant to reset the unique_ptr, not release it. Nice memory leak :P
@VmsCentral
@VmsCentral 4 года назад
@Bård S good catch. Call reset method with nullptr value will be right here. Alternative - save return of the release method and call destructor of the returned object.
@juappdev
@juappdev 4 года назад
A short while back I reverse engineered an MMO protocol, implementing a replacement server using ASIO. Ended up making heavy use of strands and IO services in order to handle most of the basic queuing. ASIO comes in pretty handy for writing performant servers! Prob my greatest frustration however was it's extremely difficult to find a good database library which works well with ASIOs async paradigm, so I ended up just using a threaded connection pool for the actual db queries. Will be interesting to see how you tackle that (if you are using a database in the backend). I also felt that it was lacking a bit when it came to actually handling packet data - you've often got to keep track of a lot of state to properly handle rate limiting, writing out packet data, handling bad packets, authentication, and so on. But then again in the long run, probably best to handle that yourself.
@radongc115
@radongc115 3 года назад
Was the mmo protocol for wow? Watching this vid because I've been working on a wow emu recently and I really want to understand the underlying networking going into it. For some reason, mmo networking is fascinating.
@smoothoctopus
@smoothoctopus 6 месяцев назад
The first 20 minutes are beyond gold, bearded man.
@jontnoneya3404
@jontnoneya3404 4 года назад
"We're not going to use sockets because...." First thing we do is create a socket
@codeman99-dev
@codeman99-dev 4 года назад
Yes, exactly. Sockets suck ...until they don't.
@brunofelix5434
@brunofelix5434 4 года назад
I love your videos .. I want a tip, what site or material can I use to get to your level? Or at least a little closer .. lol I want to learn how to make money with C++
@javidx9
@javidx9 4 года назад
lol thanks Bruno - Im not aware of any shortcuts sadly, other than boring practice. It helps to write things you actually care about, rather than text book style demonstration programs. I always recommend to people to try and write a program that can be used by one of their other hobbies - it doesnt need to be perfect or original, but it should hold your interest long enough to actually see it finished, which is a rare thing among learners.
@bobarnoldjr.1937
@bobarnoldjr.1937 4 года назад
javidx9 - thanks so much for your videos. I haven't done C/C++ since college 20 years ago. You've definitely re-sparked my interest in C. It was fun putting together a working example of the message buffer from your video. I got started writing games in my teens back in the early 90s but have done business software in my professional career. In college over a Christmas break I recall writing a centipede clone in java. Great stuff! Much appreciated!
@ChefSoldier
@ChefSoldier Год назад
actually i didnt like the series because of you are just writing and not explaining well everyting . there was tons of things that i dont know in this video you are not explaining well
@rondYT
@rondYT 4 года назад
Me trying to learn C++: 🤓 Me trying to learn Server-Client in C#: 😎 Me when I get this video recommended: 🥵
@LuisA-qm8om
@LuisA-qm8om 4 года назад
What I did is copy&paste functional code, and then modify it until i understand it;
@nekoest
@nekoest 4 года назад
Networking? WOOOOOOOOOOOO!
@blackninja9400
@blackninja9400 4 года назад
how isp is spying you?
@turf6863
@turf6863 4 года назад
Just what I needed.... Was figuring out where to start with ASIO. Documentation and example codes don't help much.
@slartibartfastBB
@slartibartfastBB 4 года назад
For MacOSX use $ brew install asio
@javidx9
@javidx9 4 года назад
Cool, thanks!
@quicktastic
@quicktastic 4 года назад
Weeks of computer college in 58 minutes. :)
@billybest5276
@billybest5276 4 года назад
this was great, can't wait for the rest of the series.
@katapoka
@katapoka 4 года назад
Such amazing coding skills and teaching technique. I really like your content. THanks
@RogueShadowTCN
@RogueShadowTCN 4 года назад
Every time, the two different audio recordings throw me for a loop. Although it works, hearing the ambient room noise when you're facing the camera suddenly makes me feel like I'm in the room with you. ...
@dhkatz_
@dhkatz_ 3 года назад
I think that's the point. It's more personal. I don't see the issue
@deathreus
@deathreus 3 года назад
You're making me nervous with all those files being marked as changed while you move on to the next thing
@gradyshastid3704
@gradyshastid3704 4 года назад
Why did you have to do this after I just spent the last six months learning socket programming.
@CottidaeSEA
@CottidaeSEA 4 года назад
Six months for learning sockets?! How can you even spend that long on sockets?
@gradyshastid3704
@gradyshastid3704 4 года назад
@@CottidaeSEA most of it was just making data structs for it. I am building a scripting language and wanted it to work with socket programming.
@CottidaeSEA
@CottidaeSEA 4 года назад
@@gradyshastid3704 Now it makes a whole lot more sense why it'd take that long. Because normally I can't imagine it taking more than a month, but that's still in-depth and with a couple of smaller projects to gain experience using them. As a side note, the two first things I made with sockets was a basic messenger and a battleships game. I already had the game ready, so I just slapped some multiplayer functionality onto it... though due to it being P2P one of the players could cheat by reading the memory, but I couldn't be bothered to add a server onto it. Even though I probably could've used the messenger server for it. Edit: this side note became the majority of the reply... well, shit.
@foamyrocks665
@foamyrocks665 4 года назад
Yeeeeees, networking dumb terminology that makes you more confused, yeeeeees (I've worked for a network testing equipment company for some time, so context, sockets, endpoints, were part of the daily job)
@doublegdog
@doublegdog 4 года назад
love this youtube channel. I am a programmer but am not familiar with C++. You do such a great job explaining concepts for newer programmers! Keep it up!
@javidx9
@javidx9 4 года назад
Glad you enjoy it doublegdog!
@pontusring7700
@pontusring7700 4 года назад
Small correction, at 55.04 I think you want to be calling reset(), not release(), otherwise you'll have a memory leak.
@walidjabari4985
@walidjabari4985 4 года назад
corporate: "so which versions of visual studio do you want to install on your computer ?" javidx9: "yes"
@nordern1
@nordern1 4 года назад
In this series, are you going to go into the complications of multiplayer games in particular, like server validated player movement that doesn't feel choppy, for example?
@GNARGNARHEAD
@GNARGNARHEAD 4 года назад
the Australian Security Intelligence Organisation? sus
@algorithminc.8850
@algorithminc.8850 3 года назад
Awesomely useful channel ... thank you.
@kaiweiyeo4279
@kaiweiyeo4279 2 года назад
Dear David Barr, Thanks for the video. I've uploaded some mistakes I made and how to solve them so that others can benefit. PROBLEM1: "C2857 '#include' statement specified with the /Ycpch.h command-line option was not found in the source file NetClient SOLUTION1: Right click the project NetClient->Properties->C/C++->All Options->Precompiled Header->"Choose the option", Not Using Precompiled Header PROBLEM2: I ran into an issue with memcpy in the video "C2664 'void *memcpy(void *,const void *,size_t)': cannot convert argument 1 from 'const main:: (*)[5]' to 'void *' SOLUTION2: Remove the "const" keyword for data extraction. When you push data out, there is no const. friend Message& operator >> (Message& msg, DataType& data)
@UrThysis
@UrThysis 4 года назад
I don't understand how people could dislike this video 🙄
@MatthewChaplain
@MatthewChaplain 4 года назад
I liked the video because it's a really good and accessible intro to modern C++ networking and the inherent complexity in the domain. I use Asio myself. But the video does have a few problems that might irk some developers. The unsigned size, which is such a small thing, might be one of those things. But probably for the "thread-safe" queue. Consider a thread that calls q.front() and then inspects the result of that function. Meanwhile, another thread has called pop_front(), invalidating the reference that the first thread is inspecting. Adding locks in this way doesn't necessarily make an object thread-safe; it very much depends on the usage patterns.
@evalaviniabucur1789
@evalaviniabucur1789 4 года назад
They're either trolls or don't understand the code even after seeing the video. I always like javidx9 videos, even though I never code in C/C++ and there are parts I don't understand. I enjoy all his explanations and the approaches he has on various problems.
@nitroflap
@nitroflap 4 года назад
Yay, networking. \[T]/
@anonanon3066
@anonanon3066 4 года назад
I always missed that "one" library for c++ networking.. THANK you! libcurl is nice but a pain to work with it's C syntax... ASIO is great! Thanks for showing me this! Also, thanks for taking the time for making all these videos. You truly are a gift for the c++ community.
@javidx9
@javidx9 4 года назад
Thanks Anonx2!
@PaweSkalczynski
@PaweSkalczynski 4 года назад
Also please note that C++ Networking TS is being specified on ASIO. There are lots of people holding thumbs that in the end we will have standard networking for C++23 (so 2023 :) )
@kamerkrali5214
@kamerkrali5214 2 года назад
I had a passion for software since I was a kid, but it was very small for what was sold at that time. It was difficult to find information in Turkish. After asking, I realized that even English was scarce on the internet at that time. Thank you for giving a lot of simple graphic emulators now.
@jeevanreddy7989
@jeevanreddy7989 Год назад
Being a C++ GUI developer, i find the concepts quiet tough to digest initially. I got to work very hard understanding and assimilating all of these network concepts. Plus the C++ here is quiet advanced and i feel like a complete novice, while watching the video. However, OLC has done a fantastic job on his part trying to explain such complex stuff in a simple manner.
@quentinquadrat9389
@quentinquadrat9389 4 года назад
I did not know ASIO until your video, it looks having a clean API. Nice !
@ryanly8565
@ryanly8565 4 года назад
This guy sounds like the dude who trolls scammer phone calls
@southernkatrina8161
@southernkatrina8161 4 года назад
Jim.
@goglom12
@goglom12 3 года назад
You also can use SFML Network module, it have a very simple interface to TCP\UDP Sockets and also have a SocketSelector!
@MsJavaWolf
@MsJavaWolf 3 года назад
Why don't you like chrono?
@javidx9
@javidx9 3 года назад
std::because::its::so::very::convoluted::in::its::typing::and_inconsistant::naming
@alalala132whyisthishandletaken
@alalala132whyisthishandletaken 4 года назад
totally tubular video. if you want to lower level with networking, get familiar with the gnu c library's sockets implementation (sys/socket.h) or winsock (gotta be familiar a lil with w32). always interesting to send crafted ipv4 packets.
@Otakutaru
@Otakutaru 4 года назад
Every. Single. Video you make... Is helpful and entertaining. Thanks!
@javidx9
@javidx9 4 года назад
Hey thanks Otakutaru, glad to see they are appreciated!
@eddek6141
@eddek6141 4 года назад
Let's fucking go!!!! I changed to and learned c++ in last 6 months for mmo networking
@dennisrkb
@dennisrkb 2 года назад
17:22 Be careful with capturing by reference. By the time the lambda runs, whatever references it captured might have become invalid. If you wanna keep data around it's best to wrap it into a shared_ptr and capture that by value.
@mohamedmoatyhassan5125
@mohamedmoatyhassan5125 4 года назад
Thank you for providing this quality content for free!
@javidx9
@javidx9 4 года назад
Glad you enjoy it!
@platinoob__2495
@platinoob__2495 3 года назад
After I create NetCommon, when I run it, it crashes saying it couldn't find NetCommon.lib, since it can't find it shouldn't create it?
@javidx9
@javidx9 3 года назад
You will need to link the lib you are creating to your projects that use it, in linker settings.
@platinoob__2495
@platinoob__2495 3 года назад
@@javidx9 Thank you for answering (and so quick) I don't know why, but I fixed it by making "NetCommon" from scratch. I also removed "SimpleExample" from the solution, it was causing exception for some reason (I guess 2 "main()"s)
@ilyasnamozov2914
@ilyasnamozov2914 3 года назад
hi, thank for your really useful info on Asio. some time ago I tried to follow this example, but I was too scared of lambda functions and multithreading, so I went back, learned a lot, and implemented my own multithreaded client server application using windows sockets. then I returned to your example and I can see that there are a lot of similar ideas for example I receive bytes using recv() in cycle using some small buffer, or for example sending and receiving in a different threads. Also I use mutexes and shared memory. I still work on my project, and now I think maybe I should rewrite it in more modern way, like your example, with lambdas and asio? I write in C++ 03, because i studied an old book "Accelerated C++"
@javidx9
@javidx9 3 года назад
Hey ilyas, sounds like you're making great progress! Yeah, I'd get used to c++17 if you can, 03 lacks a lot of the new toys to play with. But also as libraries mature they will require the features of 17. I've noticed this, a real push towards keeping c++ fresh.
@ilyasnamozov2914
@ilyasnamozov2914 3 года назад
@@javidx9 thanks for your answer, now I watched this video and understood about 85% of code, which is great for me. If you know any book on modern C++, can you please share the name of it. Thanks.
@jphvnet
@jphvnet 4 года назад
I'll check these videos... it was painful debugging my first app. Fortunately I never needed again, but I want to learn
@yashbahuguna3000
@yashbahuguna3000 3 года назад
You sound like the guy from kurzgesagt. Great video thanks alot!
@satyamraj2779
@satyamraj2779 6 месяцев назад
well, the error_code has been shifted to boost::system
@javidx9
@javidx9 6 месяцев назад
At no point does this example mention or use boost.
@KingJellyfishII
@KingJellyfishII 4 года назад
Well damn this could have saved me a lot of work if I had waited a month, I just started writing a MMO using ASIO and I did a terrible job compared to this _and_ it took me ages :p
@SparxableTunes
@SparxableTunes 3 года назад
I love that your video's doin't have distracting music because then I get to add my own distracting music while I continuously rewind your content run on sentence XD
@wolpumba4099
@wolpumba4099 2 месяца назад
*Summary* This video is the first in a series to create a custom C++ networking framework based on ASIO (Asynchronous Input Output) library, aiming for simplified client/server communication. Here's a breakdown: *Why ASIO and a Custom Framework?* (0:00) * Sockets are platform-dependent and complex to handle. * ASIO offers portability and error handling for networking. * The framework simplifies ASIO's asynchronous nature for the user. *Networking Challenges (and How This Framework Tackles Them):* (14:43) * *Unpredictable Timing:* (14:45) Network operations are asynchronous, meaning they don't happen instantly. This framework utilizes ASIO's asynchronous capabilities to run network tasks in the background without blocking the main program. * *Unknown Data Sizes:* (14:57) We don't know how much data a server will send. This framework mandates using messages with headers: * Header: Contains a unique ID (using enum class for compile-time validation) and the size of the entire message (including header). * Body: Contains the actual data (payload) of varying size. *Framework Components:* (22:48) * *Threadsafe Queue (`net_tsqueue.h`):* (45:02) Stores messages being sent and received. Utilizes mutexes to prevent data corruption from simultaneous access by multiple threads. * *Message Structure (`net_message.h`):* (27:46) * Contains the message header (ID and size) and a body (vector of bytes). * Allows easy serialization/deserialization for transmitting data. * Provides overloaded operators to push and pop data like a stack. * *Connection Object (`net_connection.h`)* (49:14) * Represents the link between client and server, handling sending and receiving messages through its socket. * Manages outgoing and incoming message queues specific to the connection. * *Client Interface (`net_client.h`):* (51:23) * Provides a simplified way for applications to connect to servers and send/receive messages. * Owns the ASIO context and the socket before a connection is established. * *Server (Discussed, Implementation in Future Videos):* (40:36) * Accepts multiple client connections and processes messages from all clients through a single incoming queue (facilitating single-threaded server design). *Key Points:* * Modern C++ features (like templates, enum classes) ensure code readability, type safety, and compiler assistance. * The goal is to abstract away the complexities of ASIO and asynchronous programming for users of this framework. * This video lays the groundwork for the series, focusing on architecture and initial implementations. The following parts will demonstrate a fully functional framework and eventually its use in a game. i used gemini 1.5 pro to summarize the youtube transcript
@kaiweiyeo4279
@kaiweiyeo4279 2 года назад
If you ever encounter something like the following PROBLEM 3: Error C7568 argument list missing after assumed function template 'Tsqueue' SOLUTION The issue is in the brackets TsQueue(const Tsqueue & = delete); //WRONG TsQueue(const Tsqueue &) = delete; //CORRECT
@sahilpohare
@sahilpohare 4 года назад
Coming from python, java and JS.........C++ syntax looks like a complete fuckfest...... WHY WOULD you use "[ ]" Randomly and that too with an &.
@l6e6i6n
@l6e6i6n 4 года назад
Networking!!! nice
@yegho5933
@yegho5933 3 года назад
WHAT !! im shocked, shouldn't have come yet until having some basic knowledge
@jonshouse1
@jonshouse1 3 года назад
When somebody who writes C++ uses the word "framework" I know I am not going to like it. I watched this in full, and yes, I do not like it but I guess that is why am not a C++ programmer. All you have here is a TCP state machine buried in C++isms. It might have been simpler to write the state machine as a thread and simply talk to the thread. I assume you are using TCP for security, for lowest latency and simpler coding UDP would be a better bet, but as you talk about hosting the game server I do understand that TCP is simpler to manage. It is good practice if the header specifies a size to use something with a bounded size to represent the data that follows. Unsigned 16 bit ensures would ensure that the data following would always be
@nicolaslandau4692
@nicolaslandau4692 4 года назад
I think I never liked a video so fast.
@eldarcuric3992
@eldarcuric3992 3 года назад
I truly enjoy your content, keep up the work, I'll contribute as soon as this specific timeline that we are in right now comes to pass.
@1777bond
@1777bond 3 года назад
I wish one day to know as much as you do..
@javidx9
@javidx9 3 года назад
Aim to know more!!
@prudhvic4
@prudhvic4 2 года назад
I have a requirement to build a TCP client-server based application which should be built using POSIX API from UNIX C standard library, is ASIO compliant to POSIX?
@traxooza
@traxooza 3 года назад
Hello! does someone know what if (thrContext.joinable()) thrContext.join(); does ? Thanks!
@williankoessler5935
@williankoessler5935 4 года назад
Heeeey finallyyy
@1J03B
@1J03B 3 года назад
Invaluable video, liked and subscribed. How much work would it be to repurpose this library/framework using UDP instead of TCP? Also, when would you want to use UDP and why? Sorry if you already answer this later in the series.
@zofe
@zofe 3 года назад
The upside of Boost, is being like a verbose application-generator. Yet, while... Boost is a bloat of: 1. Utter-complications. 2. Unreadable-code marred by nested lambdas and unadjusted curly-braces, spotted with templates. Thus spending long times glaring at 6 to 10 lines long snippets, hoping to reverse-engineer them. 3. Futures seem to break away from finite state-machines, resulting with uncertainties. Horrid. 4. 'experimental' code = Undue for distribution.
@jake3476
@jake3476 2 года назад
A lot of mental effort was clearly put into making this video as informative as it could be. Thank you for your hard work.
@JustPlainRob
@JustPlainRob 9 месяцев назад
ASIO has been "Audio Stream Input Output for many decades. You can call it Async IO or whatever but just deciding to use a different technology's name is confusing.
Далее
Why I Don't Like Singletons
29:05
Просмотров 68 тыс.
ХОККЕЙНАЯ КЛЮШКА ИЗ БУДУЩЕГО?
00:29
Лучше одной, чем с такими
00:54
Просмотров 341 тыс.
31 nooby C++ habits you need to ditch
16:18
Просмотров 789 тыс.
The Tragedy of systemd
47:18
Просмотров 1,1 млн
Google Engineer Embarrassed Me In Chess
34:41
Просмотров 265 тыс.
Should you learn C++?? | Prime Reacts
20:29
Просмотров 368 тыс.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Fortigate firewall training for beginners
3:56:14
Просмотров 368 тыс.
Networking in C++
32:50
Просмотров 248 тыс.
This is Why Programming Is Hard For you
10:48
Просмотров 888 тыс.