Please Make All the program tutorials...all of them. youre an mazing teaching...please TEACH TEACHERS how to teach like this. great job....thank you!
@nazar9496 жыл бұрын
Good Job mister Kelly! Don't give up this channel and you will be one of the famous teachers of c++ for beginners. Really good job, well done!
@sloankelly6 жыл бұрын
Thanks :)
@nazar9496 жыл бұрын
one more question) can you give me ideas of how to make a server for games. For example: i'm running server on my laptop and from other countries some people will connect to my server and then play a game together(warcraft, counter strike...) which direction should i dig for?)
@sloankelly6 жыл бұрын
Hmm.... Not easy doing that unless you have a static IP for your machine and you're willing to open up your home network to strangers. I'd maybe recommend having a central server on the internet and you and other connect to that, do the match making etc. and pair off from there.
@Gargantupimp5 жыл бұрын
People like you making videos like this is the future of education and a testament to the generosity of mankind. Thank you.
@juanminglao36992 жыл бұрын
3 years later and this is still so useful thank you!
@quantumgaming91803 жыл бұрын
Probably the most underrated video on this platform.
@ShubhamSharma-rp5tu2 жыл бұрын
Loving your content. Going to finish your playlist on networking in c++
@Massimus8885 жыл бұрын
Thank you! I'm learning about networking in C++ and want to read data from an API with HTTPS Get request. These videos really help in understanding how the fundamentals work. Thank you once again.
@LateinCecker7 жыл бұрын
Actually easier than i suspected. Very well made tutorial, thanks :)
@zvisger6 жыл бұрын
Your series has been so incredibly useful to finally understand winsock!!!! Thank you
@awaismushtaq57192 жыл бұрын
WinSock ain't exactly a rocket science. It's Microsoft's wrapper for BSD 4.2 sockets. They had to do it because Windows uses a message passing system as each Windows application contains a message pump that passes messages in a bidirectional manner so BSD 4.2 wasn't directly compatible because both UNIX and LINUX use linear kernels with Windows using hybrid kernel.
@WinningEmpire4 жыл бұрын
Thank you so much for these videos
@sloankelly4 жыл бұрын
You are so welcome!
@veseliyr3 жыл бұрын
Thank you very much for this series, very clear and straightforward.
@rshnewton5 жыл бұрын
Thanks for the video, I would love to see a websockets server for Linux machines, I guess it's pretty similar, but with a handshake negotiation first. Keep up the good work!
@awaismushtaq57192 жыл бұрын
Sorry in advance sir. I'm not Mr. Kelly but in Linux you don't need a wrapper like WinSock as BSD 4.2 are compatible with Linux as much as they are native to UNIX. A few headers change and you are good to go!
@bogdanilie14675 жыл бұрын
Thank you, sir, for this amazing material! It really helps people and thank you for your time that took making all these videos!
@Lukas-qy2on2 жыл бұрын
i love how this is simultaneausly the most readable and unreadable code. super simple to set up, absolutely abysmal function and library names for simple stuff.
@cstarsk23015 жыл бұрын
Great tutorial Thank you - you mentioned you were going to touch on keeping port open for other clients
@sloankelly5 жыл бұрын
Yes! Check out this video kzbin.info/www/bejne/mqLYqaiOmr-LndE
@leonardotorreao11933 жыл бұрын
Thank you, sir! This was really enlightening.
@itmemo86174 жыл бұрын
Thank you for sharing, you're a good programmer
@raynopowell6 жыл бұрын
First time ever I could find a video that explains what you actually do (and what the stuff stands for) and that covers what you need. Awesomeness!!! Is it possible to maybe do this in Code::Blocks for windoze and linux? Some functions only works in VS...
@sloankelly6 жыл бұрын
Sure! Check out this video: kzbin.info/www/bejne/bKKnZH-PfZKMpK8
@UnboxTheCat4 жыл бұрын
so many details! great explanation! I love it
@zeinabrahmani9634 жыл бұрын
Thank you soooo much. very simple and clear.
@empty03035 жыл бұрын
absolutely stunning tutorial, simple and straight forward, thanks.
@jayhsu51497 жыл бұрын
Thank you! This is very helpful! This video helps me a lot on doing my homework. I'm very appreciate of your hard work on making this teaching video, Thank you Sloan!
@ImmortalSoulOfIndia7 жыл бұрын
Hi Sir, Very nicely explained- it is a very help tutorial for everyone whosoever want to understand the Network Programming. I Appreciate your help.
@xxxwululu60364 жыл бұрын
this video really helps me a lot, thanks subscribed!
@dm-a19162 жыл бұрын
Great! Thank you for your video :)
@ozgurkarter43684 жыл бұрын
Thank you this was quit the example i was looking for.
@express96264 жыл бұрын
Good,so grateful
@siddharthkataria7034 жыл бұрын
Thanks a lot for this video.
@tuanat88555 жыл бұрын
Thank you very much, sir! That's great!
@ren.huajun92307 жыл бұрын
Thanks for your tutorial video, it's really helpful
@medjassertoubib44676 жыл бұрын
only a HTML programmer will give dislike XD . good video +rep
@believer68574 жыл бұрын
very informative thanks
@sorinban57127 жыл бұрын
really good example, thanks
@Kromush19956 жыл бұрын
Thumbed up and subscribed. Great quality videos and material!!
@sloankelly6 жыл бұрын
Thanks for the sub, Vlad!
@Maryna.Shcherbak7 жыл бұрын
omg thank you so much!!! You've saved me with this
@sloankelly7 жыл бұрын
You're welcome! Thanks for watching.
@jacobrichard95694 жыл бұрын
I like this, very nice.
6 жыл бұрын
Thank you very much, this video is so great.
@TeddieMovie7 жыл бұрын
Very nice Tutorial Dude :) really appreciate your work :) Love it !
@leetshare45043 жыл бұрын
Thank you! Teacher Kelly :)
@machrvon5 жыл бұрын
Nice, Thank you for your kindness tutorial.
@3deesuk6 жыл бұрын
first of all thank you so much, client side getting back the echo message and server side shows the port it is connected, but server didn't get messages. by the way i checked the sever with putty and it is working. i added cout
@f66043 жыл бұрын
First of all thanks for the best explainer video on this topic. Second I have got some questions. The part where you send and receive. There you able to put out a string because what you send was a string? I don't quite get what is actually send through the connection. What would it take to do the same with an integer or even better an array of integers. If you send an Integer is it send as an integer? (Array as well?) Hope you read this comment.
@brocksprogramming7 жыл бұрын
Thank you
@kulaningobeni204 жыл бұрын
Very helpful. Thanks
@Maniclout3 жыл бұрын
So helpful! Subscribed.
@simplifiedcontenttoday3 жыл бұрын
Amazing video : )
@alfredm.s.63965 жыл бұрын
What a great video. But I have some questions. 1st: How do you do so that multiple clients can join the same server? 2nd: In this video, both the client and the server are running on the same pc (127.0.0.1). But what if I wanted to access my server from elsewhere(both on two machines on local wifi and on machines on the other side of the globe)? Thank you!
@sloankelly5 жыл бұрын
Check out my other video that uses the select() command to allow multiple connections! kzbin.info/www/bejne/mqLYqaiOmr-LndE To connect from one machine to another on your local network, use 0.0.0.0 on the server. This will mean the program chooses the default network adapter. You can use ipconfig. This will get the servers up address. Then on the client use that IP address to connect. For externals, I wouldn’t risk it. It could open up your network to the outside. If you want to know more google network address translation and port forwarding.
@calvinkoay19394 жыл бұрын
Before proceeding to use the server IP address on the client side code, be sure to disable any antivirus Firewall and/or change windows firewall setting outbound/inbound setting: files and print transfer IPv4 address
@tylera0034 жыл бұрын
Thanks so much for these videos, it's been a massive help. But I wonder if you could help, I've Benn making a game using oxygine-framework and I'm trying to incorporate multilayer. You example runs on my system, but when I incorporate the client side to my game, I get this error: C2061 syntax error: identifier 'OUT'... File winsock2.h - lines 1064,3042,3063. Ive read about including Windows.h last but no joy. Just can't figure it out. Hope you can help, thanks in advance.
@nikolar58475 жыл бұрын
How to make this works for connecting two computers in non-local network? Which IP address and PORT we need to enter?
@marcovalentinoalvarado32905 жыл бұрын
I have exactly the same doubt
@nikolar58475 жыл бұрын
@@marcovalentinoalvarado3290 Basically, i think that we need to do something like port forward to make server computer "public" so can someone connected, but yet, lets see what will Sloan Kelly say.
@marcovalentinoalvarado32905 жыл бұрын
@@nikolar5847 It sounds cool, but i would consider the following fact, ¿should we take security measures? I cant think about internet without taking care of any kind of risk
@nikolar58475 жыл бұрын
@@marcovalentinoalvarado3290 Yeah i agree but TCP/IP is protocol for itself, i dont think there can be some security problem when you first need to run "server" and in that way enable "client" to work. After all, you will be probably using this for connecting someone you know, every other act is just nonusable.
@marcovalentinoalvarado32905 жыл бұрын
@@nikolar5847 Yes you are right, i completely agree, hope Sloan can answer to us im waiting for him so i can keep writing my code :D
@БатразДзампаев-г3у6 жыл бұрын
Thank you!!! Спасибо, брат!
@gaiabellovi75605 жыл бұрын
Great job!
@HK-sw3vi4 жыл бұрын
let's gooooo, awesom
@dasmaffin16334 жыл бұрын
The first time I call the method getline() it doesnt do anything and is skipped what results in an error, if I call it a second time it works. Third time then works too. Just the overall first doesnt. Why?
@m.zahitozcan146 жыл бұрын
Nice tutorial, thanks.
@RendernStattGendern5 жыл бұрын
thank you, this helped me a lot!
@johnshahla50427 жыл бұрын
Very nice Loved it!
@NoName-kt3ny2 жыл бұрын
Thanks!!!
@alxizr6 жыл бұрын
+Sloan kelly, Thank you very much for these contributing videos. It seems that you have great patience and lots of experience and it's always wonderful to learn something from a person like you. I have a question for you if you will be able to solve for me. I used both source codes from the server and client videos and i noticed a problem. It all runs well, but the messages won't show on the server side console. Meaning when i run the server and then the client then i have the option to write something on the client side console, when i do that it only shows messages in that console, nothing is shown In the server side. can you explain it?
@sloankelly6 жыл бұрын
It should display on the server. There is a line inside the while loop: cout
@alxizr6 жыл бұрын
yep! that was it. now the sent messages echoes also in the server. thanks very much.
@coolcool40434 жыл бұрын
Why did you use string constructor when printing a message, not a just buf?
@awaismushtaq57192 жыл бұрын
O! Almost forgot! The screen size is too small. It is a better strategy to maximise computer window and minimise personal image to any one of four corners like many videos on KZbin do. No offence!
@sabahsabah35153 жыл бұрын
can i get the syntax , cant figure out how to get it thanks for your efforts really got hold of this socket communication
@brycethompson23367 жыл бұрын
awesome tutorial, really helped! i was just wondering if could you make another video on the server part to allow multiple connections? keep up the awesome work
@sloankelly7 жыл бұрын
Yes! I keep meaning to make one :)
@brycethompson23367 жыл бұрын
Awesome! Cant wait!
@elitemodz49724 жыл бұрын
this was helpful thank you
@phudinhtruong4 жыл бұрын
tks u so much ur video help me alot
@sloankelly4 жыл бұрын
Happy to help
@phudinhtruong4 жыл бұрын
Sloan Kelly yeah i did pass the exam by a part of ur code. Keep ur great content . Big love from vietnam university student.
@sloankelly4 жыл бұрын
Nice! Hello from Canada! 😀
@KONTROLTECNOLOGIA4 жыл бұрын
Amazing Video! It is being VERY useful to create my own server/client based daemon. Just wondering how to keep the server listening even after the client is disconnected. (for the next connection) I am Learning yet. Thanks a lot! Great job!
@sloankelly4 жыл бұрын
You might want to check out this follow up video 😉 kzbin.info/www/bejne/mqLYqaiOmr-LndE
@awaismushtaq57192 жыл бұрын
Alas! Even in this video he forgot to clear out the structure sockaddr_in before filling it up. How can you forget some thing not-so-subtle as ZeroMemory function?
@ImmortalSoulOfIndia7 жыл бұрын
Do you have any video on Multi Threaded Sever i.e the server handling the multiple clients at a time?
@sloankelly7 жыл бұрын
+Intzar Ali no, but I have a video about multiple clients with one thread :) kzbin.info/www/bejne/mqLYqaiOmr-LndE Hope that helps!
@moheshwarimony26377 жыл бұрын
Could u plz make a video on server calculator...it will be helpful for us..as i am just beginner...
@moheshwarimony26377 жыл бұрын
oh i can not be able to add the calculation part..could u plz help me..i can not pass the result
@simonlester43163 жыл бұрын
Very nice and articulated tutorial. But I am running into Err# 10061 continuously, even with firewall allowed specifically for 54000 and antivirus paused too. Any ideas?? (on win10)
@sloankelly3 жыл бұрын
There might be something else running on that port. Try 54001?
@simonlester43163 жыл бұрын
@@sloankelly Thanks, its working, silly me, was not running the Server application.. :)
@moheshwarimony26377 жыл бұрын
hi, if i want make a sever calculator..then in which part i need to add the calculation part...?
@sloankelly7 жыл бұрын
+Moheshwari Mony in the receive message part of the server
@gelding4 жыл бұрын
Multi-Client server does not work with this client. Can you please explain why and how to fix it?
@elitemodz49724 жыл бұрын
is it possible to add a login for this to get connection and if the information is wrong it closes?
@nampham-xr6zz2 жыл бұрын
How did you connect the client and server?Thank
@sloankelly2 жыл бұрын
Run the server kzbin.info/www/bejne/jXXRXpuqpaefpLc first and then connect the client by running it.
@hey-zq1vq3 жыл бұрын
Great tutoril, but i have trouble getting inet_pton to run. I even copyed your source code but still the problem persists. The Error message is: "inet_pton was not declared in this scope". Would be nice if you have any idea of what to do since i feel like i lready read through half of google.
@sloankelly3 жыл бұрын
I think you might be using something other than VS/msbuild to compile? My guess is g++, this highlighted comment might help! kzbin.info/www/bejne/jXXRXpuqpaefpLc&lc=UgzthmZorcmhmuGvYGd4AaABAg
@freshy79373 жыл бұрын
hi, i got no errors i just send message but server doesnt receive it and i dont receive any stuff back
@freshy79373 жыл бұрын
the server is on vps and is coded in java but i guess it doesnt matter
@nguyenvankhanhduy39584 жыл бұрын
Could your program connect to a server over network or just in LAN ?
@sloankelly4 жыл бұрын
It’ll work out the box on a LAN. Don’t use “127.0.0.1” on the server for the IP address- use IPaddress Any (afk, it’s a constant value you can use to set the up address. Iirc it’s 0.0.0.0). For outside your own network, it’s a bit trickier. You will most likely have to use port forwarding and some kind of dynamic DNS like hamachi www.vpn.net
@saikirangattu29247 жыл бұрын
Is this all you need to know about socket programming (TCP/IP), what do you do to connect to a remote server ?
@sloankelly7 жыл бұрын
Same technique as in this video, you just need to know there remote address.
@heidifalcon99787 жыл бұрын
Hi, I hope you will see this post soon. I am struggling with the Putty program. It does not give me the "local" option hence it does not transmit any of the text. It does recognise the IP address, but that's about it. Any ideas???
@sloankelly7 жыл бұрын
Set host to 127.0.0.1, type to "raw" and port to the port # used in the server (54000..?) sorry AFK at the moment.
@maaz.sansare.092 жыл бұрын
Do I need to include any header file to use the inet_pton function?
@sloankelly2 жыл бұрын
Are you using Visual Studio? If not you might have issues getting this to work. Check out this video: kzbin.info/www/bejne/bKKnZH-PfZKMpK8
@hajay50545 жыл бұрын
I cannot run the client on g++. cannot use #include . do you have any suggestion
@sloankelly5 жыл бұрын
Check this out: kzbin.info/www/bejne/nJ7RXqOIq7OUntE
@samuelebrg88456 жыл бұрын
hi, nice video. i've tried to use socket with 64 bit visual studio. it compile correctly, but when i star the program there is no connection between server and client. do you know why ?
@sloankelly6 жыл бұрын
x64 should work just fine (locally for me at least), are you getting any errors? Is the socket, binding, listening and accept working OK? Have you tried different ports? Try 54003 for example.
@sillypuppygurl6 жыл бұрын
0 thumbs down xd congratulations . Good video 😀
@DariuszMakowski7 жыл бұрын
Hey, thanks for great tutorial! But I got issue :- ( Win10x64 cmake/clion/mingw 5 I get error here: inet_pton(AF_INET, myIp.c_str(), &hint.sin_addr); error: 'inet_pton' was not declared in this scope inet_pton(AF_INET,ip.c_str(), &hint.sin_addr); Any hints whats wrong?
@sloankelly7 жыл бұрын
My guess is you're not using Visual Studio. I haven't tried this, but according to the manual pages, man7.org/linux/man-pages/man3/inet_pton.3.html, that function prototype is located in
@DanPerks4 жыл бұрын
If anyone else has this issue, I found that moving my MinGW installation to a different folder, and adding these lines to the very top of my file worked: #define WIN32_LEAN_AND_MEAN #define WINVER 0x0A00 #define _WIN32_WINNT 0x0A00
@smitmodi716 жыл бұрын
Is there a way to connect BLE device to TCP client and receive real time data ?
@ahmedshehryar3 жыл бұрын
inet_pton was not declared in this scope. Same error in both client and server. I commented that part in the server as it was only error-handling but still got some error in collect2.exe, id returned 1 and an error in the makefile. But I don't know what to do with the client. Edit: Actually the same result (error in collect2.exe, id returned 1) after commenting that in the client too. But I don't think it's related.
@sloankelly3 жыл бұрын
What IDE / compiler are you using?
@prako27107 жыл бұрын
hello I'm using vs2010 and I'm getting errors in line inet_pton(AF_INET, ipAddress.c_str(), &hint.sin_addr); 'ipAddress' : undeclared identifier left of '.c_str' must have class/struct/union 1> type is ''unknown-type'' also 'getline': identifier not found in line getline(cin, userInput); and binary '
@sloankelly7 жыл бұрын
+prako2 this isn't a fix, but download Visual Studio 2017 community edition. For the issue you are having, make sure you don't have any errors around the #include and #pragma lines. Check the spelling of the included files and especially the lib file.
@robertreimann18467 жыл бұрын
I'm getting error: 'getLine' undefined. But I have included string. What can I do? EDIT: Haha. You have to write getLine in all lower case. Laughing my ass off right now :D THanks for the tutorial. Like form me
@dennisschnapka91484 жыл бұрын
do #inlcude
@SuperPint04 жыл бұрын
because it is a standard C function not C++, include the relevant lib like this: #include
@daniellynn61384 жыл бұрын
The primary purpose of making a server-client combination is so that I can connect to my remote server through the web. After I establish that i can connect back into my own computer through my local router, this is not a fully functional test. I want to load the IP address that I expose to the www, so I used ifconfig.me/ip, and when I used the resulting IP address, then the Client cannot find my server. Why is this, and how do I establish that this is going to make a remote connection?
@alexanderwilson56594 жыл бұрын
it works!!!
@easynavigation8472 жыл бұрын
I have tried to run both client and server but still receive error
@sloankelly2 жыл бұрын
What’s the error?
@alstarskyz6 жыл бұрын
when i start debugging, the server and client is connected. But i didnt received any chat on server, what happen?
@sloankelly6 жыл бұрын
Do you mean why can't you send messages from the server? That functionality isn't there. If you can't see the chat text echo on the server that's because there's a cout statement missing that should output the buf.
@monday27456 жыл бұрын
How do I adjust this client so it can receive and send message at all times and dont have to wait for either input or response?
@sloankelly6 жыл бұрын
You’d need to use something like the select() functions use in the multi client server video, or go multi threaded.
@dlcheats9023 жыл бұрын
When i try to connect the tcp/client to an IP where the tcp server is running on im getting an error#10060 i couldnt find any solution to that problem. Any idead why i cannot connect to other network ip? ps: i also tried disabling firewalls still didnt work.
@sloankelly3 жыл бұрын
The full list of error codes are here: docs.microsoft.com/en-us/windows/win32/winsock/windows-sockets-error-codes-2. Are you trying to connect two PCs on the same network, or across the internet?
@urgeurge63646 жыл бұрын
Hello again Sloan, My server part is working just fine but i have a problem in client side. connect() function gives an error(i changed return; to return -7; in and program terminates with -7 code). My code is an exact copy of yours.
@sloankelly6 жыл бұрын
Use WSAGetLastError() to get the WinSock error code after the connect fails. It's usually because the server isn't running or your firewall isn't permitting that connection.
@marshaaguilar25402 жыл бұрын
Why does the server not let other client on my WiFi Connect ?? Isn't it possible to make it public for anyone that's not on my WiFi to do so ?
@sloankelly2 жыл бұрын
Yes. It’s in but I don’t recommend it. It’s also way beyond the scope of this video to cover it. You can look up things like port forwarding and NAT as a starting point to open up your server to the outside. It is a DEFINITE security risk doing so. And I HIGHLY RECOMMEND you don’t attempt it. Especially if you’re just learning about writing client/server applications. (Pasted from another video you commented on, reposting here in case you see this one first)
@fandepestac62836 жыл бұрын
I get the error 'implicit declaration of function 'inet_pton' what could be the solution?
@sloankelly6 жыл бұрын
Have you included all the right headers?
@fandepestac62836 жыл бұрын
@@sloankelly I solved it compiling with visual studio because with mingw dont works
@entrolstar66116 жыл бұрын
Молодец!!!
@friendlybot106 жыл бұрын
if(connresult==socketerror) cant connect to server.Err:10061..help
@sloankelly6 жыл бұрын
What server are you running? Is it using an unused port? The port I used for these videos is 54000 but that might be used by something else on your system. Try changing the port to something else, say 54010. Don't forget to change the remote port on the client too.
@darcgames63758 ай бұрын
If I try and change the IP to my hamachi lan network it doesn't work. Do you have any idea why?
@sloankelly8 ай бұрын
Sorry -- hamachi is not my area of expertise. You might have to open up ports on your router to make it available to the outside world. You'll also have to bind it to (I think) IP_ANY (will work) or a known IP address on your machine. You can't use the loopback if you want the server to be 'known' outside of your network.
@darcgames63758 ай бұрын
@@sloankellythanks for the reply. Hamachi emulates a public local area network with a virtual adapter. I pinged my Ip address and I got no response and discovered that the virtual adapter was offline. A hamachi reinstall solved my problem. Just a heads up if you ever want to work with hamachi networks 😁👍
@sloankelly8 ай бұрын
Thank you! I’m glad you got it working and thanks for sharing what the cause / solution was!
@wyattlewis82477 жыл бұрын
My server keeps closing every time I'm open my client any help?
@sloankelly7 жыл бұрын
Can you paste the code to pastebin and provide a link?
@wyattlewis82477 жыл бұрын
Sloan Kelly I actually figured it out I had to change some settings in my visual studio took about 3 hours to figure it out. But I did figure it out and every thing worked perfectly thank you for the tutorial and am about to go check out your multiply client video!
@Yalex-os1ye7 жыл бұрын
I had the same problem LOL realised later that i put = instead of == on the first IF