Simple TCP Chat Room in Java

Поділитися
Вставка
  • Опубліковано 16 вер 2024
  • In this video we build a simple TCP chat room in Java.
    ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
    📚 Programming Books & Merch 📚
    🐍 The Python Bible Book: www.neuralnine...
    💻 The Algorithm Bible Book: www.neuralnine...
    👕 Programming Merch: www.neuralnine...
    🌐 Social Media & Contact 🌐
    📱 Website: www.neuralnine...
    📷 Instagram: / neuralnine
    🐦 Twitter: / neuralnine
    🤵 LinkedIn: / neuralnine
    📁 GitHub: github.com/Neu...
    🎙 Discord: / discord
    🎵 Outro Music From: www.bensound.com/

КОМЕНТАРІ • 85

  • @dgh25
    @dgh25 Рік тому +60

    To run multiple clients in the IDE:
    1. Run the client class
    2. Click the down-arrow in the top right corner of Intellij where is says "Client"
    3. Click "Edit configurations..."
    4. In the "Run/Debug Configurations" dialog, click the "Modify options" arrow and select "Allow multiple instances"

  • @icodigo1
    @icodigo1 10 місяців тому +6

    Love it when errors come up!, this is the real life while programming. So, also we learned how to troubleshoot our own code.

  • @shieth314
    @shieth314 Рік тому +4

    Thank you very much for the video! It was greatly helpful!
    Below are IntelliJ macros that could expedite the process for writing the main method and the standard output println method:
    - For main method: type 'psvm' then press tab to have the main method written fully
    - For System.out.println: type 'sout' then press tab to have the System.out.println method written fully

  • @Radical9535
    @Radical9535 Рік тому +6

    you should make more of these java videos! python is cool but java seems cool too!

  • @mumk
    @mumk 2 роки тому +6

    This is a lot of fun, thanks!

  • @eepikki
    @eepikki 2 роки тому +8

    I think this is the key to starting to learn java for me

    • @kaneki_ken_07
      @kaneki_ken_07 2 роки тому +1

      It's an interesting language, you should learn it.

    • @aditya_asundi
      @aditya_asundi 2 роки тому

      @@kaneki_ken_07 yes. Ppl say java is too wordy and takes a year to print hello world, but that's what makes it better. More syntax means the code is actually readable and customisable.

    • @eepikki
      @eepikki 2 роки тому

      @@kaneki_ken_07 I have done some basics but I have always just came back to Python. I love that too and it will always be number 1, but Java I feel could be a good skill

    • @meru_lpz
      @meru_lpz 2 роки тому

      It's a good time to start learning java, the language has actually been getting some updates to become less wordy (var, records)

    • @kaneki_ken_07
      @kaneki_ken_07 2 роки тому

      @@eepikki I aslo learned Python as my first language, and I too consider it as the king, C is kinda hard language, but JAVA was made with the reference to C, to get the functionality of C in easier syntax, so, you should learn JAVA as well besides Python, because Python somewhere lacks these features. And C is the most powerful language I have ever seen

  • @RanchoX
    @RanchoX 8 місяців тому +1

    The client connection probably doesn't close, because you're using .equals("/quit"), maybe the string has white spaces or next line characters which aren't captured by .equals(), .contains() is more useful on that use case

  • @hema_hb
    @hema_hb 10 днів тому

    Great tutorial ❤️👍🏼

  • @kingofcurses0275
    @kingofcurses0275 5 місяців тому

    Thank you so much! you made it really easy to understand and implement.

  • @Man-Vs-Car
    @Man-Vs-Car 2 роки тому +5

    Hope we can get more java videos. Nice!!

  • @DayshiaSweet-t7n
    @DayshiaSweet-t7n 2 місяці тому

    great tutorial. learned alot!

  • @alicoder8
    @alicoder8 Рік тому

    Positive. Useful and helpful. Like every video!🤟

  • @Dean-zi5bj
    @Dean-zi5bj Рік тому

    Thank you, I really appreciate the good material, blessings to you and your family of happiness, abundance and good health.

  • @Pages_Perfected
    @Pages_Perfected 9 місяців тому

    That was amazing, ty

  • @zakyvids6566
    @zakyvids6566 2 роки тому +1

    Consider making a short maybe 1 hour crash course on JavaScript

  • @psharma2067
    @psharma2067 2 роки тому +2

    Looks like neuralnine is reading our mind
    He is delivering content at right time

  • @someonesomewhere7057
    @someonesomewhere7057 2 роки тому +1

    Might actually try to learn Java someday

  • @jesusdacoast872
    @jesusdacoast872 2 роки тому

    Good job dude 😎

  • @Aaron-rh7sz
    @Aaron-rh7sz 2 роки тому

    That's pretty cool

  • @pconairofficial4333
    @pconairofficial4333 2 роки тому +1

    I respect you a bang

  • @Sunnythesage
    @Sunnythesage Рік тому

    Thank you!

  • @cheeesecake6989
    @cheeesecake6989 Рік тому

    Thank you !! 🙏

  • @garethharriott9582
    @garethharriott9582 2 роки тому +2

    Im getting a real annoying error
    Apparently this.client is null
    I don't know what that means and google is no help

    • @BensStuff
      @BensStuff Рік тому

      change the port to 9999

  • @ChristianErwin01
    @ChristianErwin01 Рік тому +1

    I'm able to run the server and after connecting with a client and entering the nickname, nothing happens on either end. Any reason why this may be?

    • @Doggy_Styles_Coding
      @Doggy_Styles_Coding Рік тому

      out = new PrintWriter(client.getOutputStream(), true); The true is important (autoflush). it needs to be set true in both classes. otherwise the server can't recieve the message. I had the same issue after i forgot the vriable in the PrintWriter (autoflush = true).
      Hope it will fix it.

  • @maksimbondarchuk8953
    @maksimbondarchuk8953 8 місяців тому

    I dont get more than half what are you saying, but thats pretty interesting

  • @Zandulu
    @Zandulu 2 роки тому

    Thank you

  • @nguyen1604
    @nguyen1604 Рік тому +1

    Cannot invoke "java.io.BufferedReader.close()" because "this.in" is null
    I had bug in class Client
    Can you help me fix it?

    • @emxoco
      @emxoco Рік тому

      did u fix it?

    • @emxoco
      @emxoco Рік тому

      if yes, how?

    • @hokwanhung
      @hokwanhung Рік тому

      ​@@emxoco I have fixed the problem; there are two parts: First, the port for ServerSocket (i.e. 9999) is already used; use something for TCP like 15001. Second, in the method of shutdown, include something like "if (in != null && !in.isClosed())"/"if (client != null && !client.isClosed())" so it actually will detect whether there are any sockets first.

  • @egormolkov7590
    @egormolkov7590 Рік тому

    thx man!

  • @sbipoaspirant2024
    @sbipoaspirant2024 6 місяців тому

    Hi! I have done the coding, the connections are establishing fine but the output stream and input streams are not being sent or received from server to client, can someone please help?

  • @AlmightyFork
    @AlmightyFork Рік тому +1

    does someone know a tutorial for making a gui around this code?

  • @pontusschönhult
    @pontusschönhult 3 місяці тому

    does it work from 2 defferent laptops??

  • @artofgamingwarfare3658
    @artofgamingwarfare3658 Рік тому +1

    It's weird, I can run the server once, run a client on it. once i shut down the client, i'm not able to hit run on the server again. I think I may be missing something

    • @artofgamingwarfare3658
      @artofgamingwarfare3658 Рік тому

      I don't think the server is shutting down. Edit: I got it figured out.

    • @nishanttanksale8451
      @nishanttanksale8451 Рік тому

      @@artofgamingwarfare3658 what did you do?

    • @emanuel1657
      @emanuel1657 7 місяців тому

      he probably had a dynamic ip and then changed it to static

  • @canadianbeast8671
    @canadianbeast8671 2 роки тому

    THANKS

  • @szilaszilaful
    @szilaszilaful Рік тому

    can you help? when running on different devices, it wont connect to server

  • @yh4438
    @yh4438 10 місяців тому

    Yo this so cool where can i find tutorial like this

  • @beginnerwithcode
    @beginnerwithcode 4 місяці тому

    Thanks , ı love you bro ❤ 😊

  • @amanraval7027
    @amanraval7027 Рік тому

    I think that this @override, basically i feel about it that this keyword @override is useless at line 3 because we use override for method that is have some work or some funtion to perform already but in your case the method "run" of the class Runnable just declare it is not performing any function so it looks meaninglessto me, but let meIknow if i mwrong, it would be appreciated😊🥰.

    • @debdeepsanyal9030
      @debdeepsanyal9030 5 місяців тому

      nope. you have to override and implement the run method, thats how multithreading in Java works. to start a Thread you basically call t.start() and this start method is calling the run() method in turn, hence it's important to override and implement the run() method. if you don't, you'll be getting an error.

  • @slicer8112
    @slicer8112 Місяць тому

    Anyone know what theme he is using?

  • @dangeonmaster6839
    @dangeonmaster6839 Рік тому

    How to clean ArrayList after disconnect?

  • @prakhyathshetty6509
    @prakhyathshetty6509 6 місяців тому

    does it implement SSL

  • @ohkkai
    @ohkkai Рік тому

    How do I get to this lvl of understanding? Gosh, I feel like I m stuck

  • @salahdjouama1221
    @salahdjouama1221 Рік тому

    amazing it worked on the localhost but when i try it in two deferent divices (i changed the ip addresses) it doesnt idk why

  • @alanrichter8594
    @alanrichter8594 2 роки тому

    How You Made that with the command pydir in console You go to your python directory or any other

    • @jlee3361
      @jlee3361 2 роки тому

      Google bash aliasing

  • @jackzytt
    @jackzytt 2 місяці тому

    doesnt work, doesnt let me run.

  • @easchinta184
    @easchinta184 2 роки тому

    Great video! Does anyone know if I could share this file to a friend of mine and then we could chat remotely through terminals? Or if anyone knows any tutorials on how to do that? Let's say my friend cannot program so it would be great if he only needs to get a file and make open and connect through the terminal or something.

    • @Moosh_fr
      @Moosh_fr 2 роки тому

      you need to open the file or datatype in base64 or encode it. and then share it and turn it back

    • @CarlosFernandez-js8yn
      @CarlosFernandez-js8yn Рік тому

      @@Moosh_fr can you elaborate a little more on this. What do you mean by turning it in base64?

  • @anthonygarcia2459
    @anthonygarcia2459 Рік тому

    This doesn't work if a user is typing a message while a new one is received from a different client. Please elaborate on how to fix this issue

  • @rosamaltonimussolini9715
    @rosamaltonimussolini9715 2 роки тому

    What program is it?

    • @NeuralNine
      @NeuralNine  2 роки тому

      A TCP chat room

    • @rosamaltonimussolini9715
      @rosamaltonimussolini9715 2 роки тому +1

      @@NeuralNinelike the deplovementing program (not java the program you use to deplov the chat room)

    • @omerselimatila3530
      @omerselimatila3530 2 роки тому +1

      @@rosamaltonimussolini9715 I think it isn't compitable with you, so never mind.

    • @rosamaltonimussolini9715
      @rosamaltonimussolini9715 2 роки тому +3

      @@omerselimatila3530 But I I can play a windows 10 VM :)

  • @youruncle4
    @youruncle4 2 роки тому

    s code plz

  • @xayahlover6688
    @xayahlover6688 Рік тому

    Can you share the source code?

  • @GermanTimecrafter
    @GermanTimecrafter 2 роки тому

    Weird to see you coding in Java 😂

  • @ProgrammerRajaa
    @ProgrammerRajaa 2 роки тому

    how can I get the code ?

    • @MananGandhi
      @MananGandhi 2 роки тому +6

      you dont. the whole purpose of his videos are that people code on their own and don't just copy code

    • @07GT783
      @07GT783 Рік тому +1

      @@MananGandhi you are absolutely right this is a tutorial project , not just a copy paste code project.

    • @eeeeeeeeee-d7x
      @eeeeeeeeee-d7x 7 місяців тому

      @@07GT783 have you ever considered that I don't want to break my ass watching all 40 minutes of his goddamn video trying to find where I missed a line of code that was shown for all of 5 themtoseconds so I can get a sample application to run? What difference does it make if you key in the code yourself or if you copy it from Github?

  • @mayursai7220
    @mayursai7220 2 роки тому

    Say this in c++ also

  • @brooth2566
    @brooth2566 Рік тому

    cool but who really uses java now man

    • @gintoki8503
      @gintoki8503 10 місяців тому +1

      💀 , I hope you realize that JAVA is used for a lot of things for example in space, the transmission of data from a satellite...I hope you will earn a brain. even for a lot of jobs employers ask for the applicants to know java.

    • @debdeepsanyal9030
      @debdeepsanyal9030 5 місяців тому

      Java is thriving in the backend s of literally all the companies you know of?