Java Socket Programming 4 - Multi-client interactive sessions

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ม.ค. 2025

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

  • @lovesofa
    @lovesofa 3 ปีที่แล้ว +46

    I just wanted to say thank you so much! My professor just kind of threw us to the wolves with socket programming. You're the real teacher! Food for thought: if you were to create some merch I would definitely buy + support!! Also, a part 5 would be amazingggg

  • @joanaluis6086
    @joanaluis6086 10 หลายเดือนก่อน

    Like all the previous comments of desperate CS students: I have seen dozen of videos about the topic but your playlist offered the most concise and clear explanation. Thank you for being a legend David!

  • @pl8yr
    @pl8yr 5 ปีที่แล้ว +8

    David Dobervich just wanna say thank you for the tutorial of programming the client-server architecture - your four-step video has helped me completely understand what I would like to implement in my chat application coursework when implementing multithreading, I understood the basic part, yet didn't understand what the purpose of multithreading is and you have literally cleared my understanding of its use. Thank you again and hope many others take notice of this video because it was very useful.

  • @simoneglatzeder9826
    @simoneglatzeder9826 5 ปีที่แล้ว +15

    Bro, I study information systems and am currently struggling really bad with my programming exercises, if I watched this at the beginning of this day I wouldve saved about 8 hours of my time, trying to figure this out XD thx!!!!!!

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

      if you played around for 8 hours instead of using google in an efficient way... than you maybe shouldn't study anything computer related.

    • @lovesofa
      @lovesofa 3 ปีที่แล้ว +15

      @@boohda1995 Hey! The IT community called and said they don't like your attitude. :) It just so happens that anybody can do ANYTHING they put their mind to. So you could mind your business and keep your head in the books! I mean we all ended up right here on THIS VERY youtube video after all. ;)

  • @RaVeN-fv7yh
    @RaVeN-fv7yh 2 ปีที่แล้ว +1

    Thank you sooooooooo much, I'm just at loss of words, you saved my ass. Our professor gave this us as our coursework and I didnt get a single thing on socket programming. Really grateful for you! Sunscribed and I shared this video with my colleagues.

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

    straight to the point! Thank you for this brief and concise explanation

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

    have you ever done part 5 of this series? Nice videos man!

  • @duskfern9041
    @duskfern9041 5 ปีที่แล้ว +6

    Is there anywhere where i can grab the source code too see it for myself?
    Github or something maybe? Just easier when im checking my own code to see this one rather than having to skim through the video.

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

    Thank you so much..
    I was need this like nobody wants
    I iterate this client server architecture in my mini project of java
    Thanks a lot🙏

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

    Thank you so much, for this tutorial! You really helped me a lot. ❤

  • @sebastianspence1638
    @sebastianspence1638 ปีที่แล้ว

    Sorry did you ever expand this to a part 5? thanks!

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

    I found this a great tutorial series, watched them all 4 and learned a lot besides socket programming (and still searching how you are able to run the program from clicking left in a separate console window, each :-))
    I really hope you find some time for a part 5 in which you handle the possibly unclosed or occupied port things, limiting the actual number of connections to the server instead of a "connected but not served" state (prevents using unnecessary sever resources). Also countermeasures against vandalism (hackers occupying computer (server) resources) would be an interesting topic.
    Other things i can think of is encrypted communications just to name some things in case you have trouble finding inspiration 😁 But please keep making these videos!!

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

    you are the reason I will fail one less class this semester!

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

    Yo mate, thanks a lot, it really helped me for a school project!

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

    "Ya know, your memory, with help from the IDE" .... 😂😂😂

  • @Mark-vt7pl
    @Mark-vt7pl 2 ปีที่แล้ว +1

    When i try to run the second client i get "Process 'Client' Is Running, 'Client' is not allowed to run in parallel. Would you like to stop the running one?" :(

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

      you need to change the setting to allow two windows of the client window

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

    my code not execute multi client ..why?

  • @Is-ux9jf
    @Is-ux9jf 4 ปีที่แล้ว +1

    Thanks for this video. When I type "quit", it shows me a set of errors rather than leaving the chat. How can I avoid that?

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

    This was very helpful

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

    Good video. Thank you. Learned a lot :)

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

    thank youu dude, but there is one thing I did not I understand that how could you make the client class run parallel with each other, I could not run those clients at the same time. Thank you!

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

      Edit the run configuration for the client, click: Modify options and click "Allow multiple Instances" :-)

    • @youssefyasser5601
      @youssefyasser5601 8 หลายเดือนก่อน

      @@terry1311 THANK YOU! I've been stuck so long trying to do it. God bless you

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

    let's say that we want all the clients to receive a message from the server (without getting blocked by reading the keyboard) when the server gives a specific output. What shoud we do?

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

    Why not post github link of the project....

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

      yes, sorry about that. This was made for a high school class I teach and the purpose was for them to make it themselves.

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

    Hi. Thanks for the great video. Is it possible to control (server side) when a client has disconnected? Say, a client just closed its connection, and the server becomes aware of that, and removes the disconnected client from the ArrayList, and carries on. Is this possible?

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

    hope to see the part 5

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

    Thankyou! This was great!

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

    Hey, these videos are great. I'm using android studio and have been able to use this to mostly achieve what I am trying to do with a user interface. The only problem is that once I made it so that the server sends messages to all clients, the server no longer receives the message from the client. I'm assuming is some sort of thread problem. Any advice?

  • @just3at46
    @just3at46 3 ปีที่แล้ว +4

    Thanks for those tutorials!!! One question: how did you run multiple clients? my intellij didn't let me do it.

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

      click build in the top right then go to the client.class in file explorer, shift + right-click and open powershell, then type java client in as many powershells as you need

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

    I had threadpool of 2 and it took connection from 6 clients. What am I doing wrong?

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

    Is there a chance to find this code on Github?

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

    not too long at all ;) keep going senpai

  • @coyotemoon722
    @coyotemoon722 4 ปีที่แล้ว +23

    Dude, seriously post the code. I like the videos but it's very hard to jump around to find what you were doing.

    • @Rockyzach88
      @Rockyzach88 ปีที่แล้ว

      I had an instructor once that made us do this basically. He said we would use his code but we had to read it from a fucking video. _facepalm_

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

    Your a genius

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

    how old are u?

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

    hi, great tutorial, but if i put pool.execute(clientThread), it tells me that ClientHandler cannot be converted to runnable ? Can you help me please ?

  • @tomkers850
    @tomkers850 8 หลายเดือนก่อน

    I'm not sure how it's possible to watch this. The keyboard is louder than the speaker.

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

    You are awesome!

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

    Since this program is using a Client Handler class, would it be possible to shutdown the server when any client sends a "shutdown" command to the server? I know this might not be a common behavior but I am still curious.

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

    Hi Dave,
    Thanks for your video
    I found that when I disconnect the client from the server, there's a exception:
    Exception in thread "pool-1-thread-1" java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "" is null
    at ClientHandler.run(ClientHandler.java:25)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:831)
    Is there a way to solve this problem?
    thanks

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

    Can you put here a link to download the java code? Thank you very much

  • @cyberstair
    @cyberstair 5 ปีที่แล้ว +3

    I need source code of this

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

      me too. He has changed sth in video gaps and did not record them. I ask him to put the last parts texts here. thanks

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

    I don't know much Java. How come we need to put a catch block in the run method to handle .readLine()? In the Sever.java file we didn't catch the exception.

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

    When client types quit, he cannot send messages but he keeps getting them because he is still in the list

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

    Thank you david

  • @Rockyzach88
    @Rockyzach88 ปีที่แล้ว

    If anyone is having trouble with their Client Handler getting an IOexception, make sure you delete all the swing/jframe code from the first videos. He took it out of his code. IDK if he mentioned that somewhere and I missed it or what.

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

    can i get source code ?

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

    Bro, i have question, how to send data from server to client base on ipaddress ? thankyou

    • @PankajKumar-ft7lc
      @PankajKumar-ft7lc 3 ปีที่แล้ว +1

      You can't send data from server to client. You must establish a connection beforehand then it is possible but the server can't initiate a connection.
      Now if you know the IP address then you can match it with the clientSocket.getInetAddress() for each client if they are equal send your data to that socket.

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

    if i want to connect two client using server like pubg, how is possible in java?

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

    Excellent

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

    Amazing

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

    Is this p2p?

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

    how can I disconnect a client in multi-client?

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

      you will have to create a new class (I called it RemoveFinished), let it implement runnable and put this one line of code inside the run method *for(ClientHandler c : Server.clients) if (c.finished) ((ThreadPoolExecutor) Server.pool).remove(c);*
      make sure pool and clients are public.
      in your Server class put before your previous first line of main *pool.execute(new RemoveFinished());*
      now just make sure in your ClientHandler class, you have a public boolean called finished and turn that to true when you want to disconnect. And make sure you break away from any loops. And at the first line of that run put *if(finished) return;*
      I can explain if you want, hope this helped.
      EDIT: This was just the solution I used, it may not be the best one.

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

      Could u please make this part of code a bit clearer, thanks

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

      @@lythd "in your Server class put before your previous first line of main pool.execute(new RemoveFinished());" what do you mean?

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

      Larry Chiem whatever you had first previously go before that and put in the code in bold, this was a few months ago so i cant remember much off the top my head but if you need further help im sure i could find my working code

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

      @@lythd can you pls give the GitHub link of this code if you havs any even of your own

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

    please share source code

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

    could u give a source code?

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

    source code or it didnt happen!

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

    THANK YOU DUDEE

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

    sexy typing sounds

  • @시린-d4i
    @시린-d4i 5 ปีที่แล้ว

    What is a socket?

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

      Go back to part 1 in this series. He explains it very well there

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

    cool :)

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

    Too much brightness... i didnt even recognise intellij for a few minutes

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

    it doesn't work

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

      I know

    • @Rockyzach88
      @Rockyzach88 ปีที่แล้ว

      I'm sure you're a master programmer now but it was probably because you left code in there from earlier videos that he took out and apparently didn't tell anyone.

  • @REAL-GATMAN
    @REAL-GATMAN 3 ปีที่แล้ว

    Alas you do not have an indian accent.

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

    вижу ZOV, бомблю AZOV

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

    wrg

  • @davideferrara6274
    @davideferrara6274 4 หลายเดือนก่อน

    Amazing video, thanks!

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

    code source please