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"
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
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
@@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.
@@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
@@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
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.
@@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.
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?
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
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😊🥰.
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.
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.
@@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?
💀 , 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.
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"
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
Love it when errors come up!, this is the real life while programming. So, also we learned how to troubleshoot our own code.
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
you should make more of these java videos! python is cool but java seems cool too!
I think this is the key to starting to learn java for me
It's an interesting language, you should learn it.
@@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.
@@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
It's a good time to start learning java, the language has actually been getting some updates to become less wordy (var, records)
@@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
This is a lot of fun, thanks!
Thank you, I really appreciate the good material, blessings to you and your family of happiness, abundance and good health.
Thank you so much! you made it really easy to understand and implement.
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?
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.
@@Doggy_Styles_Coding this fixed it, thanks 🙏
Cannot invoke "java.io.BufferedReader.close()" because "this.in" is null
I had bug in class Client
Can you help me fix it?
did u fix it?
if yes, how?
@@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.
Positive. Useful and helpful. Like every video!🤟
Im getting a real annoying error
Apparently this.client is null
I don't know what that means and google is no help
change the port to 9999
great tutorial. learned alot!
Why is this code not in your github? :/
Hope we can get more java videos. Nice!!
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?
Looks like neuralnine is reading our mind
He is delivering content at right time
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
I don't think the server is shutting down. Edit: I got it figured out.
@@artofgamingwarfare3658 what did you do?
he probably had a dynamic ip and then changed it to static
Great tutorial ❤️👍🏼
does someone know a tutorial for making a gui around this code?
can you help? when running on different devices, it wont connect to server
Might actually try to learn Java someday
Consider making a short maybe 1 hour crash course on JavaScript
How You Made that with the command pydir in console You go to your python directory or any other
Google bash aliasing
does it work from 2 defferent laptops??
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😊🥰.
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.
does it implement SSL
amazing it worked on the localhost but when i try it in two deferent divices (i changed the ip addresses) it doesnt idk why
I want the code of server
Anyone know what theme he is using?
Music: Book rental wit it
How to clean ArrayList after disconnect?
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.
you need to open the file or datatype in base64 or encode it. and then share it and turn it back
@@Moosh_fr can you elaborate a little more on this. What do you mean by turning it in base64?
Good job dude 😎
That was amazing, ty
Thank you !! 🙏
Yo this so cool where can i find tutorial like this
I dont get more than half what are you saying, but thats pretty interesting
Thank you
What program is it?
A TCP chat room
@@NeuralNinelike the deplovementing program (not java the program you use to deplov the chat room)
@@rosamaltonimussolini9715 I think it isn't compitable with you, so never mind.
@@omerselimatila3530 But I I can play a windows 10 VM :)
How do I get to this lvl of understanding? Gosh, I feel like I m stuck
Thank you!
I respect you a bang
That's pretty cool
thx man!
THANKS
Can you share the source code?
Yes plzz
He did you just need to watch the video.
doesnt work, doesnt let me run.
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
how can I get the code ?
you dont. the whole purpose of his videos are that people code on their own and don't just copy code
@@MananGandhi you are absolutely right this is a tutorial project , not just a copy paste code project.
@@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?
Weird to see you coding in Java 😂
Say this in c++ also
Say it in english first
cool but who really uses java now man
💀 , 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.
Java is thriving in the backend s of literally all the companies you know of?
s code plz