Creating a TCP Client in C++

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ต.ค. 2024

ความคิดเห็น • 261

  • @Rjayakis
    @Rjayakis 5 ปีที่แล้ว +40

    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!

  • @Gargantupimp
    @Gargantupimp 5 ปีที่แล้ว +1

    People like you making videos like this is the future of education and a testament to the generosity of mankind. Thank you.

  • @nazar949
    @nazar949 6 ปีที่แล้ว +3

    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.

  • @juanminglao3699
    @juanminglao3699 2 ปีที่แล้ว

    3 years later and this is still so useful thank you!

  • @quantumgaming9180
    @quantumgaming9180 3 ปีที่แล้ว +2

    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++

  • @LateinCecker
    @LateinCecker 7 ปีที่แล้ว +9

    Actually easier than i suspected. Very well made tutorial, thanks :)

  • @zvisger
    @zvisger 6 ปีที่แล้ว +4

    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.

  • @raynopowell
    @raynopowell 6 ปีที่แล้ว +7

    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 ปีที่แล้ว +2

      Sure! Check out this video: th-cam.com/video/6qD3LYH-YnM/w-d-xo.html

  • @Lukas-qy2on
    @Lukas-qy2on 2 ปีที่แล้ว +1

    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.

  • @veseliyr
    @veseliyr 3 ปีที่แล้ว +1

    Thank you very much for this series, very clear and straightforward.

  • @Massimus888
    @Massimus888 5 ปีที่แล้ว +1

    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.

  • @WinningEmpire
    @WinningEmpire 4 ปีที่แล้ว +2

    Thank you so much for these videos

    • @sloankelly
      @sloankelly  4 ปีที่แล้ว

      You are so welcome!

  • @alfredm.s.6396
    @alfredm.s.6396 5 ปีที่แล้ว +3

    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 ปีที่แล้ว +2

      Check out my other video that uses the select() command to allow multiple connections! th-cam.com/video/dquxuXeZXgo/w-d-xo.html
      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

  • @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 th-cam.com/video/dquxuXeZXgo/w-d-xo.html

  • @rshnewton
    @rshnewton 5 ปีที่แล้ว +1

    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!

  • @leonardotorreao1193
    @leonardotorreao1193 3 ปีที่แล้ว +1

    Thank you, sir! This was really enlightening.

  • @bogdanilie1467
    @bogdanilie1467 5 ปีที่แล้ว +2

    Thank you, sir, for this amazing material! It really helps people and thank you for your time that took making all these videos!

  • @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.

  • @itmemo8617
    @itmemo8617 4 ปีที่แล้ว +1

    Thank you for sharing, you're a good programmer

  • @empty0303
    @empty0303 4 ปีที่แล้ว

    absolutely stunning tutorial, simple and straight forward, thanks.

  • @tylera003
    @tylera003 4 ปีที่แล้ว +1

    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.

  • @coolcool4043
    @coolcool4043 4 ปีที่แล้ว

    Why did you use string constructor when printing a message, not a just buf?

  • @UnboxTheCat
    @UnboxTheCat 4 ปีที่แล้ว

    so many details! great explanation! I love it

  • @zeinabrahmani963
    @zeinabrahmani963 4 ปีที่แล้ว +1

    Thank you soooo much. very simple and clear.

  • @ozgurkarter4368
    @ozgurkarter4368 4 ปีที่แล้ว +1

    Thank you this was quit the example i was looking for.

  • @xxxwululu6036
    @xxxwululu6036 4 ปีที่แล้ว +1

    this video really helps me a lot, thanks subscribed!

  • @dm-a1916
    @dm-a1916 2 ปีที่แล้ว +1

    Great! Thank you for your video :)

  • @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!

  • @awaismushtaq5719
    @awaismushtaq5719 2 ปีที่แล้ว +1

    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 TH-cam do. No offence!

  • @ren.huajun9230
    @ren.huajun9230 6 ปีที่แล้ว +2

    Thanks for your tutorial video, it's really helpful

  • @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

  • @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 :) th-cam.com/video/dquxuXeZXgo/w-d-xo.html Hope that helps!

  • @gelding
    @gelding 4 ปีที่แล้ว

    Multi-Client server does not work with this client. Can you please explain why and how to fix it?

  • @dasmaffin1633
    @dasmaffin1633 3 ปีที่แล้ว

    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?

  • @Kromush1995
    @Kromush1995 6 ปีที่แล้ว +1

    Thumbed up and subscribed. Great quality videos and material!!

    • @sloankelly
      @sloankelly  6 ปีที่แล้ว

      Thanks for the sub, Vlad!

  • @hajay5054
    @hajay5054 5 ปีที่แล้ว

    I cannot run the client on g++. cannot use #include . do you have any suggestion

    • @sloankelly
      @sloankelly  5 ปีที่แล้ว

      Check this out: th-cam.com/video/fmn-pRvNaho/w-d-xo.html

  • @alxizr
    @alxizr 6 ปีที่แล้ว +1

    +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 ปีที่แล้ว +2

      It should display on the server. There is a line inside the while loop:
      cout

    • @alxizr
      @alxizr 6 ปีที่แล้ว +1

      yep! that was it. now the sent messages echoes also in the server. thanks very much.

  • @elitemodz4972
    @elitemodz4972 4 ปีที่แล้ว

    is it possible to add a login for this to get connection and if the information is wrong it closes?

  • @siddharthkataria703
    @siddharthkataria703 4 ปีที่แล้ว +1

    Thanks a lot for this video.

  • @express9626
    @express9626 4 ปีที่แล้ว +1

    Good,so grateful

  • @tuanat8855
    @tuanat8855 5 ปีที่แล้ว +1

    Thank you very much, sir! That's great!

  • @3deesuk
    @3deesuk 6 ปีที่แล้ว +2

    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

  • @nikolar5847
    @nikolar5847 5 ปีที่แล้ว +2

    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 ปีที่แล้ว +2

      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 ปีที่แล้ว +1

      @@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 ปีที่แล้ว +1

      @@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 ปีที่แล้ว +1

      ​@@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

  • @believer6857
    @believer6857 4 ปีที่แล้ว +1

    very informative thanks

  • @awaismushtaq5719
    @awaismushtaq5719 2 ปีที่แล้ว +1

    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 ปีที่แล้ว +1

    Hi Sir,
    Very nicely explained- it is a very help tutorial for everyone whosoever want to understand the Network Programming. I Appreciate your help.

  • @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: th-cam.com/video/6qD3LYH-YnM/w-d-xo.html

  • @leetshare4504
    @leetshare4504 3 ปีที่แล้ว

    Thank you! Teacher Kelly :)

  • @jacobrichard9569
    @jacobrichard9569 4 ปีที่แล้ว +1

    I like this, very nice.

  • @moheshwarimony2637
    @moheshwarimony2637 6 ปีที่แล้ว

    hi, if i want make a sever calculator..then in which part i need to add the calculation part...?

    • @sloankelly
      @sloankelly  6 ปีที่แล้ว

      +Moheshwari Mony in the receive message part of the server

  • @Maryna.Shcherbak
    @Maryna.Shcherbak 7 ปีที่แล้ว +2

    omg thank you so much!!! You've saved me with this

    • @sloankelly
      @sloankelly  7 ปีที่แล้ว

      You're welcome! Thanks for watching.

  • @TeddieMovie
    @TeddieMovie 7 ปีที่แล้ว

    Very nice Tutorial Dude :) really appreciate your work :) Love it !

  • @sorinban5712
    @sorinban5712 7 ปีที่แล้ว

    really good example, thanks

  •  6 ปีที่แล้ว +1

    Thank you very much, this video is so great.

  • @brocksprogramming
    @brocksprogramming 7 ปีที่แล้ว +7

    Thank you

  • @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.

  • @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?

  • @machrvon
    @machrvon 5 ปีที่แล้ว +1

    Nice, Thank you for your kindness tutorial.

  • @InvisibleRaptorLOL
    @InvisibleRaptorLOL 6 ปีที่แล้ว

    I have a problem. My compiler says that inet_pton is not declared in this scope. IDK if this is because the pragma comment was ignored by the compiler. It says Wunknown-pragmas.

    • @sloankelly
      @sloankelly  6 ปีที่แล้ว

      What compiler / IDE are you using? If it's not Visual Studio, you might want to take a look at my other video - getting the networking videos to work with CodeBlocks - th-cam.com/video/fmn-pRvNaho/w-d-xo.html

    • @benzakournouhaila8958
      @benzakournouhaila8958 5 ปีที่แล้ว +1

      @@sloankelly please can you check this link cause this vidéo is not working !!!

    • @sloankelly
      @sloankelly  5 ปีที่แล้ว

      Thanks for pointing this out! Link is fixed! th-cam.com/video/fmn-pRvNaho/w-d-xo.html

  • @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

  • @fandepestac6283
    @fandepestac6283 5 ปีที่แล้ว

    I get the error 'implicit declaration of function 'inet_pton' what could be the solution?

    • @sloankelly
      @sloankelly  5 ปีที่แล้ว

      Have you included all the right headers?

    • @fandepestac6283
      @fandepestac6283 5 ปีที่แล้ว +1

      ​@@sloankelly I solved it compiling with visual studio because with mingw dont works

  • @daniellynn6138
    @daniellynn6138 3 ปีที่แล้ว

    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?

  • @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.

  • @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

  • @darcgames6375
    @darcgames6375 7 หลายเดือนก่อน

    If I try and change the IP to my hamachi lan network it doesn't work. Do you have any idea why?

    • @sloankelly
      @sloankelly  7 หลายเดือนก่อน +1

      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 7 หลายเดือนก่อน +1

      @@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  7 หลายเดือนก่อน

      Thank you! I’m glad you got it working and thanks for sharing what the cause / solution was!

  • @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.

  • @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)

  • @sirgouki6207
    @sirgouki6207 5 ปีที่แล้ว

    Edit: Ok it isn't that smart, the string type is in iostream... but the function getline still requires you to include
    Come on guys.... getline IS io so why not move that to iostream since you moved string?
    Where can I submit suggestions to update the standard?

  • @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! th-cam.com/video/WDn-htpBlnU/w-d-xo.html&lc=UgzthmZorcmhmuGvYGd4AaABAg

  • @kulaningobeni20
    @kulaningobeni20 4 ปีที่แล้ว

    Very helpful. Thanks

  • @nampham-xr6zz
    @nampham-xr6zz 2 ปีที่แล้ว

    How did you connect the client and server?Thank

    • @sloankelly
      @sloankelly  2 ปีที่แล้ว

      Run the server th-cam.com/video/WDn-htpBlnU/w-d-xo.html first and then connect the client by running it.

  • @Maniclout
    @Maniclout 3 ปีที่แล้ว

    So helpful! Subscribed.

  • @smitmodi71
    @smitmodi71 6 ปีที่แล้ว

    Is there a way to connect BLE device to TCP client and receive real time data ?

  • @KONTROLTECNOLOGIA
    @KONTROLTECNOLOGIA 3 ปีที่แล้ว

    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  3 ปีที่แล้ว +1

      You might want to check out this follow up video 😉 th-cam.com/video/dquxuXeZXgo/w-d-xo.html

  • @fahdv2597
    @fahdv2597 6 ปีที่แล้ว

    Does it work if your friend from the other side of the world tries to connect using the Wan ip address?

    • @sloankelly
      @sloankelly  6 ปีที่แล้ว

      No, you'd need to have a machine with an IP address sitting on the internet to make it work.

  • @medjassertoubib4467
    @medjassertoubib4467 6 ปีที่แล้ว +1

    only a HTML programmer will give dislike XD . good video +rep

  • @monday2745
    @monday2745 5 ปีที่แล้ว

    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  5 ปีที่แล้ว

      You’d need to use something like the select() functions use in the multi client server video, or go multi threaded.

  • @fahdv2597
    @fahdv2597 6 ปีที่แล้ว

    How do you know that "127.0.0.1" is the ip address of the server?

    • @sloankelly
      @sloankelly  6 ปีที่แล้ว

      The server is running on the same machine. In networking, the IP address 127.0.0.1 always points to the local machine.

  • @niektuytel9519
    @niektuytel9519 4 ปีที่แล้ว

    i was mechanic on a company and now leave this job to learn full time programming online with practicing, is that a smart thing or you not recommend it ?

    • @sloankelly
      @sloankelly  4 ปีที่แล้ว

      Are you looking to re-skill to move into another career? It depends on your learning style. In addition a lot of places will look for some kind of college degree as a minimum for a programming job. With practice you will get better at programming. If you're doing it yourself, you should create a small project to get you started / boost confidence and build from there. It will, unfortunately take time.

    • @niektuytel9519
      @niektuytel9519 4 ปีที่แล้ว

      @@sloankelly thanks for you answer, yeah but to be on college takes as well a lot of time ... yeah for me i just get the goal to learn from sources googleing etc. (16 hours a day at least) and hope get some job :)

  • @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.

  • @williamv2520
    @williamv2520 5 ปีที่แล้ว

    This client doesn't work with your multiclient server. Could you do an updated video of a client that works with that?

    • @sloankelly
      @sloankelly  5 ปีที่แล้ว +2

      In needs to receive messages asynchronously. If you send a message using the client it will receive all the messages waiting in the queue. This was the reason that I suggested using Putty in the multi chat server video. My plan is to get back to the networking videos after this Frogger series.

  • @simplifiedcontenttoday
    @simplifiedcontenttoday 3 ปีที่แล้ว +1

    Amazing video : )

  • @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.

  • @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

  • @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

  • @balunagar6808
    @balunagar6808 5 ปีที่แล้ว

    How i resolve this error? Can you help me??
    error: 'inet_pton' was not declared in this scope|

    • @sloankelly
      @sloankelly  5 ปีที่แล้ว

      What IDE/compiler are you using?

    • @balunagar6808
      @balunagar6808 5 ปีที่แล้ว

      @@sloankelly code block

    • @sloankelly
      @sloankelly  5 ปีที่แล้ว

      Ah! You need this video too th-cam.com/video/6qD3LYH-YnM/w-d-xo.html

  • @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 ปีที่แล้ว +1

      @@sloankelly Thanks, its working, silly me, was not running the Server application.. :)

  • @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?

  • @VexaMoonlight
    @VexaMoonlight 6 ปีที่แล้ว

    I tried this client code with the Multi Client Server code and it seems to have an issue with creating an socket with Error Code 0.

    • @sloankelly
      @sloankelly  6 ปีที่แล้ว

      +PSXGamerPro1 write out WSAGetLastError() to the console to find out the real reason for failure.

    • @VexaMoonlight
      @VexaMoonlight 6 ปีที่แล้ว +1

      I think I am already doing that here: //Create socket
      SOCKET sock = socket(AF_INET, SOCK_STREAM, 0);
      if (sock = INVALID_SOCKET)
      {
      std::cerr

    • @sloankelly
      @sloankelly  6 ปีที่แล้ว

      Yep-- sock = INVALID_SOCKET. C++ is the great unforgiver when it comes to this kinds of bugs :)

  • @HK-sw3vi
    @HK-sw3vi 4 ปีที่แล้ว

    let's gooooo, awesom

  • @gaiabellovi7560
    @gaiabellovi7560 5 ปีที่แล้ว +2

    Great job!

  • @phudinhtruong
    @phudinhtruong 4 ปีที่แล้ว +1

    tks u so much
    ur video help me alot

    • @sloankelly
      @sloankelly  4 ปีที่แล้ว +1

      Happy to help

    • @phudinhtruong
      @phudinhtruong 4 ปีที่แล้ว +1

      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 ปีที่แล้ว +1

      Nice! Hello from Canada! 😀

  • @m.zahitozcan14
    @m.zahitozcan14 6 ปีที่แล้ว

    Nice tutorial, thanks.

  • @wyattlewis8247
    @wyattlewis8247 7 ปีที่แล้ว +2

    My server keeps closing every time I'm open my client any help?

    • @sloankelly
      @sloankelly  7 ปีที่แล้ว +1

      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

  • @БатразДзампаев-г3у
    @БатразДзампаев-г3у 6 ปีที่แล้ว +1

    Thank you!!! Спасибо, брат!

  • @moheshwarimony2637
    @moheshwarimony2637 6 ปีที่แล้ว +2

    Could u plz make a video on server calculator...it will be helpful for us..as i am just beginner...

    • @moheshwarimony2637
      @moheshwarimony2637 6 ปีที่แล้ว

      oh i can not be able to add the calculation part..could u plz help me..i can not pass the result

  • @RendernStattGendern
    @RendernStattGendern 5 ปีที่แล้ว

    thank you, this helped me a lot!

  • @TheDriesj11
    @TheDriesj11 5 ปีที่แล้ว

    thank you, this works for me, but when I close my Client the server shutsdown too. is this a server or a client problem?

    • @olehts8462
      @olehts8462 5 ปีที่แล้ว +1

      this is not a problem this is a feature (server)

  • @easynavigation847
    @easynavigation847 2 ปีที่แล้ว

    I have tried to run both client and server but still receive error

    • @sloankelly
      @sloankelly  2 ปีที่แล้ว

      What’s the error?