Simple TCP Chat Room in Java

Поделиться
HTML-код
  • Опубликовано: 19 дек 2024

Комментарии • 87

  • @dgh25
    @dgh25 2 года назад +64

    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"

  • @shieth314
    @shieth314 2 года назад +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

  • @icodigo1
    @icodigo1 Год назад +7

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

  • @RanchoX
    @RanchoX 11 месяцев назад +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

  • @Radical9535
    @Radical9535 Год назад +6

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

  • @eepikki
    @eepikki 3 года назад +9

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

    • @kaneki_ken_07
      @kaneki_ken_07 3 года назад +1

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

    • @aditya_asundi
      @aditya_asundi 3 года назад

      @@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 3 года назад

      @@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 3 года назад

      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 3 года назад

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

  • @mumk
    @mumk 3 года назад +6

    This is a lot of fun, thanks!

  • @Dean-zi5bj
    @Dean-zi5bj Год назад

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

  • @kingofcurses0275
    @kingofcurses0275 8 месяцев назад

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

  • @ChristianErwin01
    @ChristianErwin01 Год назад +2

    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.

    • @gauravshah7888
      @gauravshah7888 28 дней назад

      @@Doggy_Styles_Coding this fixed it, thanks 🙏

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

  • @alicoder8
    @alicoder8 Год назад

    Positive. Useful and helpful. Like every video!🤟

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

  • @DayshiaSweet-t7n
    @DayshiaSweet-t7n 5 месяцев назад

    great tutorial. learned alot!

  • @simo5678
    @simo5678 Месяц назад +1

    Why is this code not in your github? :/

  • @Man-Vs-Car
    @Man-Vs-Car 3 года назад +5

    Hope we can get more java videos. Nice!!

  • @sbipoaspirant2024
    @sbipoaspirant2024 10 месяцев назад

    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?

  • @psharma2067
    @psharma2067 3 года назад +2

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

  • @artofgamingwarfare3658
    @artofgamingwarfare3658 2 года назад +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 2 года назад

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

    • @nishanttanksale8451
      @nishanttanksale8451 2 года назад

      @@artofgamingwarfare3658 what did you do?

    • @emanuel1657
      @emanuel1657 10 месяцев назад

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

  • @hema_hb
    @hema_hb 3 месяца назад

    Great tutorial ❤️👍🏼

  • @AlmightyFork
    @AlmightyFork 2 года назад +1

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

  • @szilaszilaful
    @szilaszilaful 2 года назад

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

  • @someonesomewhere7057
    @someonesomewhere7057 3 года назад +1

    Might actually try to learn Java someday

  • @zakyvids6566
    @zakyvids6566 3 года назад +1

    Consider making a short maybe 1 hour crash course on JavaScript

  • @alanrichter8594
    @alanrichter8594 3 года назад

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

    • @jlee3361
      @jlee3361 3 года назад

      Google bash aliasing

  • @alxbudn
    @alxbudn 6 месяцев назад

    does it work from 2 defferent laptops??

  • @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 8 месяцев назад

      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.

  • @prakhyathshetty6509
    @prakhyathshetty6509 9 месяцев назад

    does it implement SSL

  • @salahdjouama1221
    @salahdjouama1221 2 года назад

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

  • @slicer8112
    @slicer8112 4 месяца назад

    Anyone know what theme he is using?

    • @IosebiGames
      @IosebiGames Месяц назад

      Music: Book rental wit it

  • @dangeonmaster6839
    @dangeonmaster6839 2 года назад

    How to clean ArrayList after disconnect?

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

  • @jesusdacoast872
    @jesusdacoast872 3 года назад

    Good job dude 😎

  • @Pages_Perfected
    @Pages_Perfected Год назад

    That was amazing, ty

  • @cheeesecake6989
    @cheeesecake6989 Год назад

    Thank you !! 🙏

  • @yh4438
    @yh4438 Год назад

    Yo this so cool where can i find tutorial like this

  • @maksimbondarchuk8953
    @maksimbondarchuk8953 11 месяцев назад

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

  • @Zandulu
    @Zandulu 2 года назад

    Thank you

  • @rosamaltonimussolini9715
    @rosamaltonimussolini9715 3 года назад

    What program is it?

    • @NeuralNine
      @NeuralNine  3 года назад

      A TCP chat room

    • @rosamaltonimussolini9715
      @rosamaltonimussolini9715 3 года назад +1

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

    • @omerselimatila3530
      @omerselimatila3530 3 года назад +1

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

    • @rosamaltonimussolini9715
      @rosamaltonimussolini9715 3 года назад +3

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

  • @ohkkai
    @ohkkai Год назад

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

  • @Sunnythesage
    @Sunnythesage 2 года назад

    Thank you!

  • @pconairofficial4333
    @pconairofficial4333 2 года назад +1

    I respect you a bang

  • @Aaron-rh7sz
    @Aaron-rh7sz 2 года назад

    That's pretty cool

  • @egormolkov7590
    @egormolkov7590 2 года назад

    thx man!

  • @canadianbeast8671
    @canadianbeast8671 3 года назад

    THANKS

  • @xayahlover6688
    @xayahlover6688 2 года назад

    Can you share the source code?

  • @jackzytt
    @jackzytt 5 месяцев назад

    doesnt work, doesnt let me run.

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

  • @ProgrammerRajaa
    @ProgrammerRajaa 3 года назад

    how can I get the code ?

    • @MananGandhi
      @MananGandhi 3 года назад +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 10 месяцев назад

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

  • @GermanTimecrafter
    @GermanTimecrafter 3 года назад

    Weird to see you coding in Java 😂

  • @mayursai7220
    @mayursai7220 3 года назад

    Say this in c++ also

  • @brooth2566
    @brooth2566 Год назад

    cool but who really uses java now man

    • @gintoki8503
      @gintoki8503 Год назад +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 8 месяцев назад

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

  • @youruncle4
    @youruncle4 2 года назад

    s code plz