Creating a TCP Client in C++

  Рет қаралды 84,920

Sloan Kelly

Sloan Kelly

Күн бұрын

Пікірлер: 261
@Rjayakis
@Rjayakis 5 жыл бұрын
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!
@nazar949
@nazar949 6 жыл бұрын
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!
@sloankelly
@sloankelly 6 жыл бұрын
Thanks :)
@nazar949
@nazar949 6 жыл бұрын
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?)
@sloankelly
@sloankelly 6 жыл бұрын
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.
@Gargantupimp
@Gargantupimp 5 жыл бұрын
People like you making videos like this is the future of education and a testament to the generosity of mankind. Thank you.
@juanminglao3699
@juanminglao3699 2 жыл бұрын
3 years later and this is still so useful thank you!
@quantumgaming9180
@quantumgaming9180 3 жыл бұрын
Probably the most underrated video on this platform.
@ShubhamSharma-rp5tu
@ShubhamSharma-rp5tu 2 жыл бұрын
Loving your content. Going to finish your playlist on networking in c++
@Massimus888
@Massimus888 5 жыл бұрын
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.
@LateinCecker
@LateinCecker 7 жыл бұрын
Actually easier than i suspected. Very well made tutorial, thanks :)
@zvisger
@zvisger 6 жыл бұрын
Your series has been so incredibly useful to finally understand winsock!!!! Thank you
@awaismushtaq5719
@awaismushtaq5719 2 жыл бұрын
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.
@WinningEmpire
@WinningEmpire 4 жыл бұрын
Thank you so much for these videos
@sloankelly
@sloankelly 4 жыл бұрын
You are so welcome!
@veseliyr
@veseliyr 3 жыл бұрын
Thank you very much for this series, very clear and straightforward.
@rshnewton
@rshnewton 5 жыл бұрын
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!
@awaismushtaq5719
@awaismushtaq5719 2 жыл бұрын
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!
@bogdanilie1467
@bogdanilie1467 5 жыл бұрын
Thank you, sir, for this amazing material! It really helps people and thank you for your time that took making all these videos!
@Lukas-qy2on
@Lukas-qy2on 2 жыл бұрын
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.
@cstarsk2301
@cstarsk2301 5 жыл бұрын
Great tutorial Thank you - you mentioned you were going to touch on keeping port open for other clients
@sloankelly
@sloankelly 5 жыл бұрын
Yes! Check out this video kzbin.info/www/bejne/mqLYqaiOmr-LndE
@leonardotorreao1193
@leonardotorreao1193 3 жыл бұрын
Thank you, sir! This was really enlightening.
@itmemo8617
@itmemo8617 4 жыл бұрын
Thank you for sharing, you're a good programmer
@raynopowell
@raynopowell 6 жыл бұрын
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...
@sloankelly
@sloankelly 6 жыл бұрын
Sure! Check out this video: kzbin.info/www/bejne/bKKnZH-PfZKMpK8
@UnboxTheCat
@UnboxTheCat 4 жыл бұрын
so many details! great explanation! I love it
@zeinabrahmani963
@zeinabrahmani963 4 жыл бұрын
Thank you soooo much. very simple and clear.
@empty0303
@empty0303 5 жыл бұрын
absolutely stunning tutorial, simple and straight forward, thanks.
@jayhsu5149
@jayhsu5149 7 жыл бұрын
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!
@ImmortalSoulOfIndia
@ImmortalSoulOfIndia 7 жыл бұрын
Hi Sir, Very nicely explained- it is a very help tutorial for everyone whosoever want to understand the Network Programming. I Appreciate your help.
@xxxwululu6036
@xxxwululu6036 4 жыл бұрын
this video really helps me a lot, thanks subscribed!
@dm-a1916
@dm-a1916 2 жыл бұрын
Great! Thank you for your video :)
@ozgurkarter4368
@ozgurkarter4368 4 жыл бұрын
Thank you this was quit the example i was looking for.
@express9626
@express9626 4 жыл бұрын
Good,so grateful
@siddharthkataria703
@siddharthkataria703 4 жыл бұрын
Thanks a lot for this video.
@tuanat8855
@tuanat8855 5 жыл бұрын
Thank you very much, sir! That's great!
@ren.huajun9230
@ren.huajun9230 7 жыл бұрын
Thanks for your tutorial video, it's really helpful
@medjassertoubib4467
@medjassertoubib4467 6 жыл бұрын
only a HTML programmer will give dislike XD . good video +rep
@believer6857
@believer6857 4 жыл бұрын
very informative thanks
@sorinban5712
@sorinban5712 7 жыл бұрын
really good example, thanks
@Kromush1995
@Kromush1995 6 жыл бұрын
Thumbed up and subscribed. Great quality videos and material!!
@sloankelly
@sloankelly 6 жыл бұрын
Thanks for the sub, Vlad!
@Maryna.Shcherbak
@Maryna.Shcherbak 7 жыл бұрын
omg thank you so much!!! You've saved me with this
@sloankelly
@sloankelly 7 жыл бұрын
You're welcome! Thanks for watching.
@jacobrichard9569
@jacobrichard9569 4 жыл бұрын
I like this, very nice.
6 жыл бұрын
Thank you very much, this video is so great.
@TeddieMovie
@TeddieMovie 7 жыл бұрын
Very nice Tutorial Dude :) really appreciate your work :) Love it !
@leetshare4504
@leetshare4504 3 жыл бұрын
Thank you! Teacher Kelly :)
@machrvon
@machrvon 5 жыл бұрын
Nice, Thank you for your kindness tutorial.
@3deesuk
@3deesuk 6 жыл бұрын
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
@f6604
@f6604 3 жыл бұрын
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.
@brocksprogramming
@brocksprogramming 7 жыл бұрын
Thank you
@kulaningobeni20
@kulaningobeni20 4 жыл бұрын
Very helpful. Thanks
@Maniclout
@Maniclout 3 жыл бұрын
So helpful! Subscribed.
@simplifiedcontenttoday
@simplifiedcontenttoday 3 жыл бұрын
Amazing video : )
@alfredm.s.6396
@alfredm.s.6396 5 жыл бұрын
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!
@sloankelly
@sloankelly 5 жыл бұрын
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.
@calvinkoay1939
@calvinkoay1939 4 жыл бұрын
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
@tylera003
@tylera003 4 жыл бұрын
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.
@nikolar5847
@nikolar5847 5 жыл бұрын
How to make this works for connecting two computers in non-local network? Which IP address and PORT we need to enter?
@marcovalentinoalvarado3290
@marcovalentinoalvarado3290 5 жыл бұрын
I have exactly the same doubt
@nikolar5847
@nikolar5847 5 жыл бұрын
@@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.
@marcovalentinoalvarado3290
@marcovalentinoalvarado3290 5 жыл бұрын
@@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
@nikolar5847
@nikolar5847 5 жыл бұрын
@@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.
@marcovalentinoalvarado3290
@marcovalentinoalvarado3290 5 жыл бұрын
​@@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у
@БатразДзампаев-г3у 6 жыл бұрын
Thank you!!! Спасибо, брат!
@gaiabellovi7560
@gaiabellovi7560 5 жыл бұрын
Great job!
@HK-sw3vi
@HK-sw3vi 4 жыл бұрын
let's gooooo, awesom
@dasmaffin1633
@dasmaffin1633 4 жыл бұрын
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.zahitozcan14
@m.zahitozcan14 6 жыл бұрын
Nice tutorial, thanks.
@RendernStattGendern
@RendernStattGendern 5 жыл бұрын
thank you, this helped me a lot!
@johnshahla5042
@johnshahla5042 7 жыл бұрын
Very nice Loved it!
@NoName-kt3ny
@NoName-kt3ny 2 жыл бұрын
Thanks!!!
@alxizr
@alxizr 6 жыл бұрын
+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?
@sloankelly
@sloankelly 6 жыл бұрын
It should display on the server. There is a line inside the while loop: cout
@alxizr
@alxizr 6 жыл бұрын
yep! that was it. now the sent messages echoes also in the server. thanks very much.
@coolcool4043
@coolcool4043 4 жыл бұрын
Why did you use string constructor when printing a message, not a just buf?
@awaismushtaq5719
@awaismushtaq5719 2 жыл бұрын
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!
@sabahsabah3515
@sabahsabah3515 3 жыл бұрын
can i get the syntax , cant figure out how to get it thanks for your efforts really got hold of this socket communication
@brycethompson2336
@brycethompson2336 7 жыл бұрын
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
@sloankelly
@sloankelly 7 жыл бұрын
Yes! I keep meaning to make one :)
@brycethompson2336
@brycethompson2336 7 жыл бұрын
Awesome! Cant wait!
@elitemodz4972
@elitemodz4972 4 жыл бұрын
this was helpful thank you
@phudinhtruong
@phudinhtruong 4 жыл бұрын
tks u so much ur video help me alot
@sloankelly
@sloankelly 4 жыл бұрын
Happy to help
@phudinhtruong
@phudinhtruong 4 жыл бұрын
Sloan Kelly yeah i did pass the exam by a part of ur code. Keep ur great content . Big love from vietnam university student.
@sloankelly
@sloankelly 4 жыл бұрын
Nice! Hello from Canada! 😀
@KONTROLTECNOLOGIA
@KONTROLTECNOLOGIA 4 жыл бұрын
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!
@sloankelly
@sloankelly 4 жыл бұрын
You might want to check out this follow up video 😉 kzbin.info/www/bejne/mqLYqaiOmr-LndE
@awaismushtaq5719
@awaismushtaq5719 2 жыл бұрын
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?
@ImmortalSoulOfIndia
@ImmortalSoulOfIndia 7 жыл бұрын
Do you have any video on Multi Threaded Sever i.e the server handling the multiple clients at a time?
@sloankelly
@sloankelly 7 жыл бұрын
+Intzar Ali no, but I have a video about multiple clients with one thread :) kzbin.info/www/bejne/mqLYqaiOmr-LndE Hope that helps!
@moheshwarimony2637
@moheshwarimony2637 7 жыл бұрын
Could u plz make a video on server calculator...it will be helpful for us..as i am just beginner...
@moheshwarimony2637
@moheshwarimony2637 7 жыл бұрын
oh i can not be able to add the calculation part..could u plz help me..i can not pass the result
@simonlester4316
@simonlester4316 3 жыл бұрын
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)
@sloankelly
@sloankelly 3 жыл бұрын
There might be something else running on that port. Try 54001?
@simonlester4316
@simonlester4316 3 жыл бұрын
@@sloankelly Thanks, its working, silly me, was not running the Server application.. :)
@moheshwarimony2637
@moheshwarimony2637 7 жыл бұрын
hi, if i want make a sever calculator..then in which part i need to add the calculation part...?
@sloankelly
@sloankelly 7 жыл бұрын
+Moheshwari Mony in the receive message part of the server
@gelding
@gelding 4 жыл бұрын
Multi-Client server does not work with this client. Can you please explain why and how to fix it?
@elitemodz4972
@elitemodz4972 4 жыл бұрын
is it possible to add a login for this to get connection and if the information is wrong it closes?
@nampham-xr6zz
@nampham-xr6zz 2 жыл бұрын
How did you connect the client and server?Thank
@sloankelly
@sloankelly 2 жыл бұрын
Run the server kzbin.info/www/bejne/jXXRXpuqpaefpLc first and then connect the client by running it.
@hey-zq1vq
@hey-zq1vq 3 жыл бұрын
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.
@sloankelly
@sloankelly 3 жыл бұрын
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
@freshy7937
@freshy7937 3 жыл бұрын
hi, i got no errors i just send message but server doesnt receive it and i dont receive any stuff back
@freshy7937
@freshy7937 3 жыл бұрын
the server is on vps and is coded in java but i guess it doesnt matter
@nguyenvankhanhduy3958
@nguyenvankhanhduy3958 4 жыл бұрын
Could your program connect to a server over network or just in LAN ?
@sloankelly
@sloankelly 4 жыл бұрын
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
@saikirangattu2924
@saikirangattu2924 7 жыл бұрын
Is this all you need to know about socket programming (TCP/IP), what do you do to connect to a remote server ?
@sloankelly
@sloankelly 7 жыл бұрын
Same technique as in this video, you just need to know there remote address.
@heidifalcon9978
@heidifalcon9978 7 жыл бұрын
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???
@sloankelly
@sloankelly 7 жыл бұрын
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.09
@maaz.sansare.09 2 жыл бұрын
Do I need to include any header file to use the inet_pton function?
@sloankelly
@sloankelly 2 жыл бұрын
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
@hajay5054
@hajay5054 5 жыл бұрын
I cannot run the client on g++. cannot use #include . do you have any suggestion
@sloankelly
@sloankelly 5 жыл бұрын
Check this out: kzbin.info/www/bejne/nJ7RXqOIq7OUntE
@samuelebrg8845
@samuelebrg8845 6 жыл бұрын
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 ?
@sloankelly
@sloankelly 6 жыл бұрын
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.
@sillypuppygurl
@sillypuppygurl 6 жыл бұрын
0 thumbs down xd congratulations . Good video 😀
@DariuszMakowski
@DariuszMakowski 7 жыл бұрын
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?
@sloankelly
@sloankelly 7 жыл бұрын
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
@DanPerks
@DanPerks 4 жыл бұрын
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
@smitmodi71
@smitmodi71 6 жыл бұрын
Is there a way to connect BLE device to TCP client and receive real time data ?
@ahmedshehryar
@ahmedshehryar 3 жыл бұрын
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.
@sloankelly
@sloankelly 3 жыл бұрын
What IDE / compiler are you using?
@prako2710
@prako2710 7 жыл бұрын
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 '
@sloankelly
@sloankelly 7 жыл бұрын
+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.
@robertreimann1846
@robertreimann1846 7 жыл бұрын
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
@dennisschnapka9148
@dennisschnapka9148 4 жыл бұрын
do #inlcude
@SuperPint0
@SuperPint0 4 жыл бұрын
because it is a standard C function not C++, include the relevant lib like this: #include
@daniellynn6138
@daniellynn6138 4 жыл бұрын
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?
@alexanderwilson5659
@alexanderwilson5659 4 жыл бұрын
it works!!!
@easynavigation847
@easynavigation847 2 жыл бұрын
I have tried to run both client and server but still receive error
@sloankelly
@sloankelly 2 жыл бұрын
What’s the error?
@alstarskyz
@alstarskyz 6 жыл бұрын
when i start debugging, the server and client is connected. But i didnt received any chat on server, what happen?
@sloankelly
@sloankelly 6 жыл бұрын
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.
@monday2745
@monday2745 6 жыл бұрын
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?
@sloankelly
@sloankelly 6 жыл бұрын
You’d need to use something like the select() functions use in the multi client server video, or go multi threaded.
@dlcheats902
@dlcheats902 3 жыл бұрын
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.
@sloankelly
@sloankelly 3 жыл бұрын
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?
@urgeurge6364
@urgeurge6364 6 жыл бұрын
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.
@sloankelly
@sloankelly 6 жыл бұрын
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.
@marshaaguilar2540
@marshaaguilar2540 2 жыл бұрын
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 ?
@sloankelly
@sloankelly 2 жыл бұрын
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)
@fandepestac6283
@fandepestac6283 6 жыл бұрын
I get the error 'implicit declaration of function 'inet_pton' what could be the solution?
@sloankelly
@sloankelly 6 жыл бұрын
Have you included all the right headers?
@fandepestac6283
@fandepestac6283 6 жыл бұрын
​@@sloankelly I solved it compiling with visual studio because with mingw dont works
@entrolstar6611
@entrolstar6611 6 жыл бұрын
Молодец!!!
@friendlybot10
@friendlybot10 6 жыл бұрын
if(connresult==socketerror) cant connect to server.Err:10061..help
@sloankelly
@sloankelly 6 жыл бұрын
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.
@darcgames6375
@darcgames6375 8 ай бұрын
If I try and change the IP to my hamachi lan network it doesn't work. Do you have any idea why?
@sloankelly
@sloankelly 8 ай бұрын
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.
@darcgames6375
@darcgames6375 8 ай бұрын
@@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 😁👍
@sloankelly
@sloankelly 8 ай бұрын
Thank you! I’m glad you got it working and thanks for sharing what the cause / solution was!
@wyattlewis8247
@wyattlewis8247 7 жыл бұрын
My server keeps closing every time I'm open my client any help?
@sloankelly
@sloankelly 7 жыл бұрын
Can you paste the code to pastebin and provide a link?
@wyattlewis8247
@wyattlewis8247 7 жыл бұрын
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-os1ye
@Yalex-os1ye 7 жыл бұрын
I had the same problem LOL realised later that i put = instead of == on the first IF
@salvadorarreolarodriguez6165
@salvadorarreolarodriguez6165 5 жыл бұрын
@@wyattlewis8247 can you please extend? xD
Multiple Chat Clients: One Thread (in C++)
27:46
Sloan Kelly
Рет қаралды 135 М.
Creating a TCP Client in C++ [Linux / Code Blocks]
24:59
Sloan Kelly
Рет қаралды 24 М.
When mom gets home, but you're in rollerblades.
00:40
Daniel LaBelle
Рет қаралды 145 МЛН
Disrespect or Respect 💔❤️
00:27
Thiago Productions
Рет қаралды 37 МЛН
Socket Server Class in C++ - Abstracting the Network Layer
41:45
Sloan Kelly
Рет қаралды 23 М.
Creating a TCP Server in C++
30:31
Sloan Kelly
Рет қаралды 326 М.
КАК УСТРОЕН TCP/IP?
31:32
Alek OS
Рет қаралды 209 М.
The Unreasonable Effectiveness of Linux Workstations
12:47
No Boilerplate
Рет қаралды 643 М.
Starter UDP Server And Client in C++
35:51
Sloan Kelly
Рет қаралды 85 М.
Compilers, How They Work, And Writing Them From Scratch
23:53
Adam McDaniel (kiwi)
Рет қаралды 216 М.
Chat Client/Server in C# and C++ (WinForms, WinSock) (2020)
41:13
Creating a TCP Server in C++ [Linux / Code Blocks]
43:15
Sloan Kelly
Рет қаралды 88 М.
When mom gets home, but you're in rollerblades.
00:40
Daniel LaBelle
Рет қаралды 145 МЛН