For all those unconvinced it can work, please download and try the prototype project here! onelonecoder.itch.io/meaningless-cog
@Zaneris
4 жыл бұрын
Decided to provide some tea for this quality content ;) Keep up the good work.
@javidx9
4 жыл бұрын
Thank you Zaneris! Much appreciated!
@javidx9
4 жыл бұрын
Yeah asio comes with ssl objects you can use to negotiate https. A bit too complex for a simple introduction 😁
@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
4 жыл бұрын
thanks for all the work you do! as someone learning c++, you are truly helpful thank you
@comment1652
4 жыл бұрын
I have no idea what i'm watching, but thank you bearded man for the knowledge.
@javidx9
4 жыл бұрын
Best comment ever XD
@mattmurphy1065
3 жыл бұрын
I work in IT, and the only thing I understood was the networking lol
@soundbreaker2485
3 жыл бұрын
HTTPS changed the strings being sent in plain text though
@williamgomez6087
3 жыл бұрын
You have to see "Hands on Machine Learning whit python"...
@devhonk1722
3 жыл бұрын
@@LockeIProd and that does not count from 1 lmao
@filmcase1683
4 жыл бұрын
This man will always be the person I go to for difficult c++ programs
@superscatboy
4 жыл бұрын
It's a real shame he refuses to use modern C++ idioms and techniques.
@qx-jd9mh
4 жыл бұрын
@@superscatboy Cniles are set in their ways
@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
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
4 жыл бұрын
@@superscatboy Well, the best modern C++ idiom in most cases probably is to ditch it for Rust ;-)
@motbus3
4 жыл бұрын
Stop and realize for one moment how great the content OLC has been posting. Really amazing.
@sterdot
4 жыл бұрын
Coming from a music production background, I was very confused by ASIO in the title...
@javidx9
4 жыл бұрын
Lol yes, its quite an unfortunate coincidence!
@ВячеславЗамулов
4 жыл бұрын
@@javidx9 I wish there were more tutorials on Steinberg's ASIO, lol
@user-yr1uq1qe6y
4 жыл бұрын
I thought the exact same thing when I saw the title come up.
@lucadavidian5441
4 жыл бұрын
Me too!
@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.
@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
3 жыл бұрын
still how can i make my vs work with that?
@welcomereality924
3 жыл бұрын
@@crazypeter113 check the properties files vscode creates, there must be some sort of parameter for includes iirc
@sketburd9360
3 жыл бұрын
this ^^^
@The_Nelliel
3 жыл бұрын
Thank you, omg lol I was getting pissed lol
@ajaydalal199
Жыл бұрын
thanks bro, you saved me a lot of time and headache.
@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
Жыл бұрын
this video is explanation of how web works under the hood.
@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
3 ай бұрын
C++ is for people who like to find problems for their solutions.
@leftofzen
Жыл бұрын
If you're using modern c++, why use std::vector instead of std::vector ?
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_
4 жыл бұрын
[2]
@johnbrodie9815
4 жыл бұрын
same my dude
@trobinsoon
2 жыл бұрын
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 (:
@241lolololol
3 жыл бұрын
Hey javid, Sorry if this was already asked but is ASIO something youd program with for commercial purposes?
@javidx9
3 жыл бұрын
I would and have.
@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
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?
@SourceCodeDeleted
4 жыл бұрын
I am really interested to see this !!! Much needed !!!
@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
4 жыл бұрын
Your user name gives me anxiety
@SourceCodeDeleted
4 жыл бұрын
@@stewartzayat7526 Not the first time I have heard this))
@deleater
3 жыл бұрын
@@SourceCodeDeleted you make me want to create another account named "Executable Reverse Engineered" lol.
@ppb2374
15 сағат бұрын
讲得真好,谢谢老师!以前复制示例,一知半解,也能用,今天听了老师的讲解豁然开朗!
@persoulrpg
4 жыл бұрын
Golden content, yet it's free. Appreciate it people :-)
@doommaker4000
3 жыл бұрын
@Rusty Boomerton We know
@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
@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.
@samuelcampbell6559
3 жыл бұрын
"Oh no _not Boost_"... I laughed out loud.
@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
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
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
3 жыл бұрын
@@conatcha i read your previous post .. and yes - YT is randomly deleting comments
@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р
Жыл бұрын
*only on windows
@khatdubell
4 жыл бұрын
Minor nit: I think you called it a template function. Its function template.
@youtissoum
3 жыл бұрын
anyone know how to fix the problem of std::scoped_lock not begin defined in the tsqueue
@javidx9
3 жыл бұрын
Sure, enable c++17 for your compiler
@youtissoum
3 жыл бұрын
@@javidx9 how do you enable it (i'm using vs 2019)
@javidx9
3 жыл бұрын
@@youtissoum project properties, language standard, c++17
@youtissoum
3 жыл бұрын
@@javidx9 thanks it dont give me errors anymore
@giorgioguglielmone6528
2 жыл бұрын
Would it be possible to use wxWidgets and Boost Asio together to create an Asynchronous Client, using Visual Studio C ++ 2022?
@selami32
4 жыл бұрын
i dont have enough IQ to understanding these courses so i watch these when i need to sleep
@southernkatrina8161
4 жыл бұрын
And ASIO is Australia's government spy network. Australian Security Intelligence Organisation....
@re.liable
4 жыл бұрын
Holy sh- same lol
@mihapetek3418
3 жыл бұрын
@@southernkatrina8161 ASIO is also music production program...
@unlikelysalmon786
3 жыл бұрын
@@southernkatrina8161 ASIO is also 4/5ths of a calculator
@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.
@DegradationDomain_stuff
3 жыл бұрын
debOOger - for when you need to remove your boogers overcUm the problem - every time
@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.
@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
Жыл бұрын
thanks for the tips dude!
@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
4 жыл бұрын
Hey thanks buddy! It's a formula that works.
@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
@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.
@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 :)
@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!
@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).
@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
4 жыл бұрын
He means it. if ppl downloaded the non-boost version. The `#define ASIO_STANDALONE` is not required anymore.
@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
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
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::
@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
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.
@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
4 жыл бұрын
This!
@baardi2
4 жыл бұрын
@javid9x 55:05 I think you meant to reset the unique_ptr, not release it. Nice memory leak :P
@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.
@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)
@bongumsamamba5146
4 жыл бұрын
this dude makes everything looks simple
@smoothoctopus
6 ай бұрын
The first 20 minutes are beyond gold, bearded man.
@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
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.
@katapoka
4 жыл бұрын
Such amazing coding skills and teaching technique. I really like your content. THanks
@jontnoneya3404
4 жыл бұрын
"We're not going to use sockets because...." First thing we do is create a socket
@codeman99-dev
4 жыл бұрын
Yes, exactly. Sockets suck ...until they don't.
@deathreus
3 жыл бұрын
You're making me nervous with all those files being marked as changed while you move on to the next thing
@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!
@TheKluxi1
4 жыл бұрын
hello
@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)
@rondYT
4 жыл бұрын
Me trying to learn C++: 🤓 Me trying to learn Server-Client in C#: 😎 Me when I get this video recommended: 🥵
@LuisA-qm8om
4 жыл бұрын
What I did is copy&paste functional code, and then modify it until i understand it;
@pontusring7700
4 жыл бұрын
Small correction, at 55.04 I think you want to be calling reset(), not release(), otherwise you'll have a memory leak.
@slartibartfastBB
4 жыл бұрын
For MacOSX use $ brew install asio
@javidx9
4 жыл бұрын
Cool, thanks!
@turf6863
4 жыл бұрын
Just what I needed.... Was figuring out where to start with ASIO. Documentation and example codes don't help much.
@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_
3 жыл бұрын
I think that's the point. It's more personal. I don't see the issue
@quicktastic
4 жыл бұрын
Weeks of computer college in 58 minutes. :)
@gradyshastid3704
4 жыл бұрын
Why did you have to do this after I just spent the last six months learning socket programming.
@CottidaeSEA
4 жыл бұрын
Six months for learning sockets?! How can you even spend that long on sockets?
@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
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.
@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.
@billybest5276
4 жыл бұрын
this was great, can't wait for the rest of the series.
@ryanly8565
4 жыл бұрын
This guy sounds like the dude who trolls scammer phone calls
@southernkatrina8161
4 жыл бұрын
Jim.
@nekoest
4 жыл бұрын
Networking? WOOOOOOOOOOOO!
@blackninja9400
4 жыл бұрын
how isp is spying you?
@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.
@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
4 жыл бұрын
Glad you enjoy it doublegdog!
@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?
@walidjabari4985
4 жыл бұрын
corporate: "so which versions of visual studio do you want to install on your computer ?" javidx9: "yes"
@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.
@UrThysis
4 жыл бұрын
I don't understand how people could dislike this video 🙄
@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
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.
@eddek6141
4 жыл бұрын
Let's fucking go!!!! I changed to and learned c++ in last 6 months for mmo networking
@GNARGNARHEAD
4 жыл бұрын
the Australian Security Intelligence Organisation? sus
@goglom12
3 жыл бұрын
You also can use SFML Network module, it have a very simple interface to TCP\UDP Sockets and also have a SocketSelector!
@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
4 жыл бұрын
Thanks Anonx2!
@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 :) )
@Otakutaru
4 жыл бұрын
Every. Single. Video you make... Is helpful and entertaining. Thanks!
@javidx9
4 жыл бұрын
Hey thanks Otakutaru, glad to see they are appreciated!
@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
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
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.
@satyamraj2779
6 ай бұрын
well, the error_code has been shifted to boost::system
@javidx9
6 ай бұрын
At no point does this example mention or use boost.
@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
@quentinquadrat9389
4 жыл бұрын
I did not know ASIO until your video, it looks having a clean API. Nice !
@yashbahuguna3000
3 жыл бұрын
You sound like the guy from kurzgesagt. Great video thanks alot!
@mohamedmoatyhassan5125
4 жыл бұрын
Thank you for providing this quality content for free!
@javidx9
4 жыл бұрын
Glad you enjoy it!
@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
3 жыл бұрын
You will need to link the lib you are creating to your projects that use it, in linker settings.
@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)
@jphvnet
4 жыл бұрын
I'll check these videos... it was painful debugging my first app. Fortunately I never needed again, but I want to learn
@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
@algorithminc.8850
3 жыл бұрын
Awesomely useful channel ... thank you.
@nitroflap
4 жыл бұрын
Yay, networking. \[T]/
@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 &.
@erroneum
4 ай бұрын
Did you know that in C++, the main() function has an implicit `return 0;` at the end? Per the standard, you don't need to explicitly return anything unless it's an error code.
@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
@traxooza
3 жыл бұрын
Hello! does someone know what if (thrContext.joinable()) thrContext.join(); does ? Thanks!
@techpupil-au
5 ай бұрын
27:25 "I dont know yet if I am going to use all of these [libraries], they just happen to be the ones that I like..." "Except for Chrono..."
@JustPlainRob
8 ай бұрын
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.
@behrouzm9045
3 жыл бұрын
Was not 'std::is_trivially_copyable' more proper than 'std::is_standard_layout' at 33:00?
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.
@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?
@edfcsx
8 ай бұрын
Is a wonderfull video thanks bro, i have an question why uses vector structure to body ? would be easier uses dinamyc size strucures ? Please don't take my question seriously, I'm still new to C++
@jarnathan-snow
7 ай бұрын
One of a kind channel, thanks for all the content. Could be possible in the future for you to do some C game programming stuff without relying on any library such as asio and only OS api? I feel I'm not learning fully how everything works if I use boost.
@jarrod752
3 жыл бұрын
Hrmm... I wonder what he can accomplish in an hour.... _Proceeds to build a full feature rich networking library..._
@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.
@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.
@paulc2448
4 жыл бұрын
at 45:52: T const& tsqueue::front() { std::scoped_lock lock(muxQueue); return deqQueue.front(); } It won't be thread safe. Client will receive a reference to an element of the queue although the lock is released. Nothing is preventing another thread to modify the queue while the client has still a reference on an element of the queue. T tsqueue::pop_front() returning a copy will be fine. T tsqueue::front() would solve the issue. The next issues are: a) Grabbing messages one by one from a Consumer thread will generate a lot of copies and allocations due to message implementation (containing a vector), b) The tsqueue queue is locked far too often (1 lock at each message read, 1 lock at each message write). Producer & Consumer thread will fight each other. I suggest that Consumer & Producer threads use each their own buffer. 1) locks the entire queue at once. 2) swap producer message buffer with consumer message buffer (empty at that point). 3) release the lock. 4) process consumer messages buffer. 5) clear consumer message buffer (ready for next swap).
@arbitervildred8999
Жыл бұрын
I followed the entire tutorial, and at the end where you make the example with "CustomClient" class, olc::net::client_interface is not visible and throws an error. we have to add (#include "net_client.h") in "olc_net.h"
@przemeks9121
Жыл бұрын
Pretty cool stuff here but I'm wondering if the part in which std::vector of integers in conjunction with memcpy and resize is used to store any POD in a messsage, could perhaps be substituted with something more modern. Looks dodgy.
Пікірлер: 927