Java Socket Programming Client Server Messenger

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

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

  • @nixer8605
    @nixer8605 3 года назад +39

    i've been really sad last few days because my teacher expects so much from us, and he doesnt even try to explain and makes me want to quit programming so bad...he just doesnt care...this video helps a bit! greetings from croatia!

    • @WittCode
      @WittCode  3 года назад +7

      Hey! It's awful having a teacher that doesn't put in the time to explain things! Hope it gets better and hello from the US 🤠

  • @user-uh4if7yp9v
    @user-uh4if7yp9v 4 года назад +15

    I learn more from your videos than I ever did in school. I look forward to seeing your tiny head on my screen every day!

    • @WittCode
      @WittCode  4 года назад

      Thanks for watching!

  • @wintersol9921
    @wintersol9921 3 года назад +26

    This video is a great help, thanks a lot. I appreciate how you put work on this video, you gave lots of information, put extra info at the bottom, and gave a quick tour of what's happening at backstage of the program. Thanks a lot man.

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

      Thanks so much for all the positive feedback! It means more than you know! 😀

  • @kei3300
    @kei3300 2 года назад +12

    Amazing video the little captions helped a lot and actually explaining each command line by line is so helpful or the fact that a byte has stream while others have reader. So much better than my prof and im paying 20k in tuition

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

    I wish I hadn't wasted time on other RUclips videos, thanks alot... You hv simplified my work and understanding... Great job

  • @malikclarke2893
    @malikclarke2893 2 года назад +5

    Great video, especially the way you explain the concepts and give definitions for important terms!

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

    Shock to see how few videos he's got given how GOOD he is...

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

      Wow thanks Mark! That really means a lot! 🤠

  • @nicolasc9648
    @nicolasc9648 2 года назад +5

    Dude this is absolutely fantastic. You keep going like this and you’ll do amazing. Thank you

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

    learned alot from the video! but can i make a suggestion to zoom in a little when you are typing in the code to make viewing a little easier on the eye. As someone who was trying to follow along with my own IDE, it was hard to have both screens at the same time. thanks again! :)

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

    Really great explanation. Those short infos you used are really helpful :)

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

      Thanks Fabio! Glad it was helpful! 😀

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

    Thanks for the help.I was doing the same practice but had no idea what host ip address to put in.Here I see you just put localhost as the target host.Thanks

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

    Very underrated thanks for the good explanation and explaining every part good luck with your channel!

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

    Thank you. This filled in some pretty sketchy holes in my knowledge before a term assignment.

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

    Thanks for explaining how the streams and readers actually work! Great Video!

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

    Great tutorial, thank you for your time and effort. The short definitions/explanations helped tremendously. 🙏

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

    The source code is not in the website

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

    Amazing! I am a programming beginner and could follow you very well, I will check out your other videos as well :) Good Job, thank you a lot!

  • @beterax
    @beterax 2 месяца назад +2

    Bombastic explanation!

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

    Thank for for the tutorial. You put so much effort into the vid to make it understandable thank you!

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

    This has been a great help to me I will definitely recommend you to my friends because they need help on this too

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

    Hello, can I put the server and client in different devices would they work then??

  • @ירדןשי-צ2ה
    @ירדןשי-צ2ה 11 дней назад

    I had issue with the server.
    Every time I typed "bye" it closed the program but kept the server on.
    The way to fix it was by deleting the second loop in the server's code.
    Now the only problem is:
    There are still "broken" ports that I can't use anymore, they throw the error: "Exception in thread "main" java.net.BindException: Address already in use: bind ...."
    I'm trying to find out how to fix that and I will update if I find an answer!

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

    I haven't seen this video yet! But awesome! I needed this for class 😬😬

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

      Always great to hear! Thanks! 😎

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

    Fantastic video just a little suggestion try to zoom in a bit

  • @MrUnknown-il4pm
    @MrUnknown-il4pm 2 года назад

    Dude thank you so much. This helled me undestand a lot! Instantly subscribed! Keep it up man 👍👌

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

    You're a great teacher!

  • @YassinSuper13
    @YassinSuper13 4 года назад +1

    Very good keep going 👍💙

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

    When I send the Message "BYE" to end the connection the Client works as expected but my Server throws the following Exception:
    Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.lang.String.equalsIgnoreCase(java.lang.String)" because "msgFromClient" is null
    at com.view/com.model.Server.main(Server.java:53)
    Any suggestions what is going wrong? I copied the code 1:1 to be sure it works..
    Thanks so far for the video!!

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

    Thank you so much for this tutorial!

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

      Thank you for watching! 😁

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

    For the server, it gives me trouble for the while loop. and when I run either one of them it says connection refused.

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

    Thank you soo much it helped a lot looking forward to learn from you

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

    Thank you for this, I've successfully configured this but let's say I have multiple clients sending to the server. How would I keep the client data & send it to all clients on that server?

  • @HarpreetSingh-cl1sp
    @HarpreetSingh-cl1sp 2 года назад

    Thanks for video. But please tell if i build friends live location app. By using android studio . Can we send data i app to other throw sockets.... I means i can't use firebase for storing and sending LONGITUDE AND LATITUDE data to server to client app ?

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

    Can you please do GUI + DB reads/writes + Socket all in one? Love your work

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

    thanks for the tutorial, but I can't send multiple messages to the server at the same time, every time I want that , I must reconnect the client to the server again , I just wrote the same code of the tutorial

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

    Excellent tutorial.

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

    where can i find the code for this it is not on the blog :(((

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

    thanks for the tutorial, what about different device connecting to the same network?

  • @ozmaozmaozmaozma
    @ozmaozmaozmaozma 2 года назад +2

    Is your source code available anywhere?
    I’m certain I’ve copied your tutorial step by step, but unfortunately I’m running into errors.
    I’m able to send one message from the client just fine. It shows up in the sever terminal perfectly!
    Whenever I try to send a second message, however, my client terminal says “Sever: null” instead of “Sever: MSG Received”
    and then any further attempts crashes the program.
    Edit: Scratch that. For some reason, closing out of my IDE and reopening it cleared that issue. Thanks a ton for the tutorial!

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

      Could u plz share that code with me.plzz🙏🙏

  • @jhuluan-jyun2594
    @jhuluan-jyun2594 2 года назад

    Really helpful sir! Appreciate it a lot

  • @alireza.m
    @alireza.m Год назад

    Very helpful video!

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

    Thanks for that video !

  • @RonyTheRhombus.
    @RonyTheRhombus. Год назад

    Really great video thank you!

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

    i am trying the above code nut for a specific host address and port, iam getting connection refused or connection timeout, can someone tell me what iam doing wrong?

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

    For some reason it doesn't work for me and i copied it word for word
    And this project doesn't exist at the download link to download it

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

    Great tutorial!

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

    how to make other computer join the conversation or how to other computer connect to your pc which run java server code

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

    can you help me? I can not find the file to download the code

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

    is there anyway to make the server talk back other than message recieved

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

    Great video, thanks a lot man!

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

    What code do I use to be able to block a client in my application

  • @michaelbassimer9353
    @michaelbassimer9353 4 года назад +1

    good video...very informative!

    • @WittCode
      @WittCode  4 года назад

      Thanks for watching Michael!

  • @Sauce-ke
    @Sauce-ke 3 месяца назад

    I cant find the code for this

  • @alovesxo9581
    @alovesxo9581 4 года назад +1

    @WittCode thanks! Can you make a video like this with multiple clients/threads?

    • @WittCode
      @WittCode  4 года назад +1

      Hey! Thanks for watching! I'm working on that and a couple other videos at the moment!

  • @LE.LL0
    @LE.LL0 2 года назад

    how can you make the server in a way that you can close and start the connection while running the program? and thank you for this amazing content.

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

    Very good, thank you!

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

    Thanks! Helped me alot :D

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

    how to send the message in following
    form → {message, SHA_256_hash_value}. Once the server receives the message it will parse it, calculate
    the SHA_256 hash value of the message part and compare it with the received hash. If values are
    matching it will send 'OK' back to Client, else 'Message was compromised'.

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

      Hey there! That sounds to me like you are trying to implement something similar to a json web token. Id look up online about that and some library in java for encrypting and decrypting?

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

      @@WittCode yes

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

    This is TCP or UDP?

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

    Can we do this setup for remote client

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

    I don't really can see this video, it's too small for me :/

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

    This saved me 🙏

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

    Did I stuff up, because for me the Client and Server must be on the same computer. If this is a general thing, how can I fix this.

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

      Hey there! If you are wanting to connect to a different computer you have to specify the IP address in the socket constructor. So instead of new Socket("localhost", 1234) you will need the connection information of your server. This can get a little messy due to network address translation (going from a public to private network essentially). I am hoping to make a video on this soon when I get a second computer haha

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

      @@WittCode Also what type of IP? e.g. IPv4 IPv6 etc

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

      @@montescottbarber9813 Great question! The socket constructor can accept either so it just depends on if the server you are connecting to is using ipv6 or ipv4. For example, localhost on ipv6 would be the following: Socket socket = new Socket("::1", 5000);

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

      @@WittCode Thanks for responding. Ur the best.👌👍

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

      @@WittCode Hi there, I have the same code as you but i get lots of these errors 'Server.java:56: error: cannot find symbol
      bufferedReader.close();'

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

    dude this is amazing
    thank you

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

      Great to hear man! Thanks for the support! 😁

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

    Nice job. Keep it up. Can I know how to send msg sever to client what are the changes should I do for it

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

      Hey Kalana! The code would basically be the same but have it so the client is waiting for messages as opposed to the server! I'll probably make a video on this at some point 🤠

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

    This video is so awesome.Thank you for sharing.I am cant seem to enter more than one input from the clients side.After saying hi,the server replies message received.Then I cannot enter any other entries from the client.Is any one else having this issue?

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

      Hey there! Thanks so much for watching! To me it sounds like your client is waiting for more data from the server! Did you forget to flush the buffer from the server along with a new line?

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

      @@WittCode Thank you for the feedback,Yes I did flush the buffer from the server along with the new line.
      github.com/Hloni-Malebana/Client-Server-Algorithm.git

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

    This is a fantastic video. Intelliji is in light mode tho. And for that reason I'm out.

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

      Thanks so much Bezalel! I have gotten a few comments about the light mode 😂😂

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

    Please where can I get the code? Is it for free?

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

    Awesome...

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

    Not getting code ? Plz put jt

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

    Thank you!

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

      Anytime Christopher thanks for watching!

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

    thank you

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

    dude, this helped me solve my homework AND it deepened my understanding, thank u so much

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

    i just get a bunch (18) of these errors!!!!!
    'symbol: variable bufferedReader
    location: class Server
    Server.java:57: error: cannot find symbol
    bufferedWriter.close();'

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

    Love you

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

    Sir can you make a tutorial on how to make a file uploader button in java eclipse? Btw my system is a lan messenger i just need it for my school project proposal

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

      Hey Ben! That's a good idea for a video so thanks! Do you mean you click a button and it opens the file explorer in windows or whatever OS you are using and you choose the file you want to send to the other user? I would most likely implement this with JavaFX.

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

      Yes sir!

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

      @@benswollo2050 yeah man I'll definitely make a video on that!

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

      Thank you so much sir

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

      I only use java eclipse cause thats what my teacher told because were beginners

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

    Good content

  • @VinayKumar-tv5bc
    @VinayKumar-tv5bc 2 года назад

    pls share code also

  • @sara..4745
    @sara..4745 2 года назад

    Can i have these codes

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

    i love you

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

    copy kan dulu jagultop

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

    Please never post a video with this screen zoom again, it's impossible to watch without hard eyes effort😵‍💫😵

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

      Hey Eril yeah I zoom in in my later videos lol

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

      ​@@WittCode Thanks so, your tutorials are amazing... and I like it

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

    hi man i love your content and i need help with java. what's your email, i would probably need help.

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

      Hey there! You can ask me questions here if you want? What are you struggling with?