Thank you very much for your tutorial. I searched for a way sending data from an Android device to a raspberry pi and the way using a java socket was the only one that worked for me. I searched a few days through the internet and other ways in java didn't worked for me. I am so happy that i've found you.
randomly land to your channel and Loving it!! ......easy to understand ........ you don't only write code but expaint that too . Thankyou ......keep uploading .... 😍
зашёл глянуть,как передавать файлы,а тут в начале показывается про постройку внешнего вида приложения и это очень помогло понять JFrame в создании внешнего вида.Всё очень круто!!)И на твой код приятно смотреть)
@WittCode do you have any videos on how to implement a gremlin function in a Java client script, that will allow the probability of damaged packets to be input as an argument when the program is executed?
Thank you for the awesome tutorial! I followed everything you did and double checked using your GitHub code. However, whenever I click on "Yes" for downloading, the file doesn't download on my server :/ can you please help?
@@akeidz Hey Ahmad good to hear from you again! So this program should be able to send any type of file over including pdf and pptx but it can only preview the content of text and images. So you can send over a pdf but not display the content of it. Though I dont think that would be too hard to implement!
Can you share your codei please? Because I wrote Server and Client code and when i try to send a file from client to server. I couldn't see my file on the server receiver list. Thanks.
Hey I have school project due in few hours relared to java socket and was wondering if you have any suggestions on how to send and receive objects through arbitrary data
Hey Parth sorry for the late response! I haven't looked into sending objects yet but that could be a new video! I would do what I did in this video and convert each of the objects properties to byte arrays and send them to the server and recreate the object there! There might be another way but I haven't looked into it too much yet! Hope this helps 🤠
Hi WittCode thank you so much for your easy to understand explanation! But I'm having an issue where I try to send file to the server but nothing happen. Do you know why this is happening?
hey great video thanks a lot, but i have a problem , it works fine on my pc, but when i send from another it dosent complete and the readfully keeps waiting and not recieving, every other function i have works so the other pc is for sure connected to the socket but it dosent read all bytes
Hey Jacob! Yes you can use other devices you just have to provide the right connection details to the socket object! The client uses localhost because the server is on the same computer. If you were using another computer you need to specify the IP address of the server! It won't be localhost! Hope this helps!
@@jacobchammai3704 that is correct! A socket object is IP address and port number to communicate on! So supply the port number the server is listening on and it's IP address!
Excuse me i am having a little problem i hope you can help me with it, i want to try and run this server from a button from my application for a uni project, when i tried running it with the Server.main(new String[0]); it freezes and the whole IDE stops working, so i thought i would try and run it using threads, i did it but the application does not seem to run, i would really appreciate any help. thank you in advance
Hey Charbel! What do you mean by run this server from a button? You mean you press a button on a GUI and the server starts? In this example the server is up and running when the application starts.
Hey Kristan! That's an interesting question! I believe you could by running them with separate threads? So implement the runnable interface to the server class and set it up and run it in the overriden run() method. And then run the client as is. Or vice versa. There might be other ways but I'm not entirely sure. Hope this helps!
i am facing ana error C:\Users\PC\IdeaProjects\client bhanu\src\client3.java:9:8 java: class Client is public, should be declared in a file named Client.java
Hey there! It seems like you created a class called Client in a file where the name is not Client.java? It seems like you might have named it Client3.java. Make sure the name of the class and file match!
@@WittCode for example, i like to create a reservation system for hotel. So the server will calculate the price arh sent back to the client, and the client can download the receipt.. That's what I think.. Thanks WittCode
@@kumak9890 This could definitely be made this way! Im not sure if it is the best way but you could get the values from the client and parse them and then create a file on the server with the calculated values and send it back to the user just like in this video! Maybe an email would be better for something like this?
@@kumak9890 No worries! I'll actually be making a video on how to send an email with Java at some point so that'll probably explain it best. But I would say when you get a purchase from the client parse the values and send an email receipt?
Hey Piyush! They do not need to be on the same network but you need the right connection information. You just have to pass this into the Socket constructor. 😃
@@piyushkesharwani1987 I'm guessing your friends computer is on a private network so the router will have a public address but your friends computer will most likely be private. I am not sure how to work around this but if I do I'll let you know 🤠
Hey there! You can! With a socket connection you just need to provide the correct port number and IP address that you want to connect to. So you would use the target IP address as opposed to 'localhost' in the socket constructor.
@@WittCode but how we can open the address?..i just made the question one more time in some comment but put it also here in case you have time and you want to help...
@@TinNguyenThanh-ko6pi oh yeah this is an old video. The laptop I wrote the code on died and was lost with it! You'll just have to copy the code in the video
Hi WittCode thank you so much for your easy to understand explanation! But I'm having an issue where I try to send file to the server but nothing show up in the Server Jframe. Here is the link of the code that I have done: docs.google.com/document/d/19OFc0GoOcXTWs7APUwvJAHf1wJJK4tKPp9eZq_vPMrc/edit?usp=sharing. BTW, What IDE are you using? Can you give me a download link?
Thank you very much for your tutorial. I searched for a way sending data from an Android device to a raspberry pi and the way using a java socket was the only one that worked for me. I searched a few days through the internet and other ways in java didn't worked for me. I am so happy that i've found you.
Hey Sören! That's great to hear! Thank you for the kind words!
i saw some guy i comments asked you to make this video and you did...you are amazing....
Thanks for the kind words! I also thought it was a very cool thing to make haha
Your content will always stand out!
The way you concisely and precisely describe each step....❤🎉
Thank you so much 😀
Hello can you give me this code ?
@@TinNguyenThanh-ko6pi I lost this code long ago on my old laptop...
Man’s saving lives out here. Thank you so much, I thought I was done in for this assignment until I found this video!
yes sir
This guy just saved my lazy student ass! Greets from Austria!
This Guy is saving Litteral Lives
randomly land to your channel and Loving it!! ......easy to understand ........ you don't only write code but expaint that too . Thankyou ......keep uploading .... 😍
Great to hearJatin! Thanks so much for the support! 😁
Vraiment c'est du bon boulot. Je parles français, mais j'ai tous compris. Thank you very much sir.
That's great to hear! Thanks for watching 🤠
зашёл глянуть,как передавать файлы,а тут в начале показывается про постройку внешнего вида приложения и это очень помогло понять JFrame в создании внешнего вида.Всё очень круто!!)И на твой код приятно смотреть)
I love ur hints over the video. u made a great work!
Thanks it helped me a lot, I am not really using java sockets, but instead using netty, but sending logic is the same, so thanks for help!
Any advice on not seeing 40 ads in this video? Jk get that money bro. Great explaination, it was super helpful!
You are amazing, thank you from Latin America !!!
What is with the smiley face at the end lol! Awesome content though man
Hey Cursed Trousers 👖👖! It was because I had a green screen issue lol I though it was honestly kind of creepy but I kept it haha
You are the GOAT, great video, definitely subscribing
Thanks so much! Welcome to the WittCode family haha 😃
Thank You! This helped me a lot, very easy to understand
Thanks For This wittcode!
Anytime Lanz! Thanks for watching!
you saved my family from extinction
i could find the code for java server client chat but couldnt find the one for file sharing in your website could you help me out?
bro, that's an amazing program to study from. Thanks a lot!
Cybersecurity left the chat. Besides that really cool tutorial.
Wittcode coming in clutch......thanks boss
Anytime Bertie! Thanks for stampeding the like button! 🦖
@WittCode do you have any videos on how to implement a gremlin function in a Java client script, that will allow the probability of damaged packets to be input as an argument when the program is executed?
Thanks man I needed this for class but a little less complicated lol
Hey John! As long as it works 🤠
Sir hats off to you.... plz make more java videos and improve my knowledge as a developer
Thanks Mohit! I will definitely be making more Java videos! 😃
you are my saver ! Thanks man ! Waiting for your new video about Java
Hey Shia! Anytime! I'm trying to get a new video out next week on Java 😀
@@WittCode cool ! I learned a lot about java (especial socket) from your video . Cant waiting to watch it
Thanks for the content man.. Expecting more.
Thanks Khandaker! There are certainly more of these videos to come! 😀
Great video!
Great to hear Dillon! Thanks for watching! 🤠
Thank you for the awesome tutorial! I followed everything you did and double checked using your GitHub code. However, whenever I click on "Yes" for downloading, the file doesn't download on my server :/ can you please help?
Very helpful! Subscribed and liked :)
Great to hear Ahmad! Glad it helped! 😃
@@WittCode Just one question at, 40:00 what if I want to send other files extension like pdf, pptx. Does it work the same as the one you code for txt?
@@akeidz Hey Ahmad good to hear from you again! So this program should be able to send any type of file over including pdf and pptx but it can only preview the content of text and images. So you can send over a pdf but not display the content of it. Though I dont think that would be too hard to implement!
@@WittCode Ah I see, I might have missed that part lol Thanks a lot mister WittCode!
Good video dude, really interesting, I made it and works perfectly as it shoud thanks a lot.❤
Can you share your codei please? Because I wrote Server and Client code and when i try to send a file from client to server. I couldn't see my file on the server receiver list. Thanks.
thank you, very helpful.
Thanks man, it really helped me a lot.
Anytime! Thank you for watching! 😀
cool bro plz make videos on android game dev and webdev
Very useful Thank you so much
Anytime Arul! Thanks for watching! 😃
Nice !
Hey I have school project due in few hours relared to java socket and was wondering if you have any suggestions on how to send and receive objects through arbitrary data
Hey Parth sorry for the late response! I haven't looked into sending objects yet but that could be a new video! I would do what I did in this video and convert each of the objects properties to byte arrays and send them to the server and recreate the object there! There might be another way but I haven't looked into it too much yet! Hope this helps 🤠
@@WittCode thank you
Thank you so much bro 👏👏
Anytime man! Thanks so much for watching! 😀
Hi WittCode thank you so much for your easy to understand explanation! But I'm having an issue where I try to send file to the server but nothing happen. Do you know why this is happening?
Same issue... Did you find the solution yet??
excellent tutorial
That's always great to hear! Thanks for watching 🤠
can you please share the link to the code. the link in the description did not work. Much needed. Thank you
Sadly I don't have this code anymore as I lost it on my old PC. When you say the link didn't work do you mean my website was down?
@@WittCode ohh that's fine. No i meant i didn't find the code which i needed that's it
Thanx so much❤🎉
😀
hey great video thanks a lot, but i have a problem , it works fine on my pc, but when i send from another it dosent complete and the readfully keeps waiting and not recieving, every other function i have works so the other pc is for sure connected to the socket but it dosent read all bytes
The readInt is receiving a different value from the writeInt in the client and idk why :(
Can I also share pdf file and download it instead of text or png file, using this method?
The code is missing from your website can you please provide the code????
excuse me but can this code be used to send data over devices connected on the same local host? or what is the purpose of it otherwise?
Hey Jacob! Yes you can use other devices you just have to provide the right connection details to the socket object! The client uses localhost because the server is on the same computer. If you were using another computer you need to specify the IP address of the server! It won't be localhost! Hope this helps!
@@WittCode so if the client was another device, i would have to specify the private IP address of the pc that the server is open on right?
@@jacobchammai3704 that is correct! A socket object is IP address and port number to communicate on! So supply the port number the server is listening on and it's IP address!
it's an amazing video . THanks a lot you saved my lazy student ass , but I can't find the code in your website.
gold video !
code is not available in your website
if i want to send files from server to clients what should i modify
What if I wanted to maintain a record of file being shared like at what time and etc?
How will this be done?
Thanks
Hey Arun! I would use the Java date class and after a file is sent just have a method that records the time and then saves it somewhere.
Thanks for your helpful videos, I wonder if there is a way to contact you, I want to ask some important questions if you don't mind
When I click on the file in the server Fram
Nothing happened
thank you very much it's great video . but if you can help me i want send and download files between multi clients and server !!
you are amazing .
Hey Nachwa! That is definitely a video for the future! 😀It will be the same thing but with multiple threads to handle multiple clients.
How to transfer complex objects, lets say color of a circle?
Where is the code i don't founded when get to download it
Thnx for this amazing video
YOU ARE PERFECT 👌
But when I run the client project
The labels don't appear ?
Please i need your help
Excuse me i am having a little problem i hope you can help me with it, i want to try and run this server from a button from my application for a uni project, when i tried running it with the Server.main(new String[0]); it freezes and the whole IDE stops working, so i thought i would try and run it using threads, i did it but the application does not seem to run, i would really appreciate any help. thank you in advance
Hey Charbel! What do you mean by run this server from a button? You mean you press a button on a GUI and the server starts? In this example the server is up and running when the application starts.
you need onother thread....
Can't find it on ur website 😢
Can u plz share these two files:client and server?
Thanks for this video. Please can you send us the code of this video?
you saved my ass dude :)
nice!
Its posible to dont choose the file and send a specific file every time u execute it ?
Hey there! Yes you can! Instead of doing the JOptionPane just have create a File object from the file you want to send and send that over!
good bro
Thanks for the kind words! 🤓
wittcode please give the sourcecode of this Java Socket Programming - Send and Download Files Between Client and Server
Hey man! Yeah I'm gonna upload it to my GitHub today so I'll post the link in the description!
You are cool man
@@WittCode plzz do it
Hey dude sorry I forgot about this! I'll get it to today and send the link to you here 🤓
@@WittCode thanku but fast wittcode!
Code no longer available?
does this still work if you put the server and cient int the same project but diffrent packages?
Hey Kristan! That's an interesting question! I believe you could by running them with separate threads? So implement the runnable interface to the server class and set it up and run it in the overriden run() method. And then run the client as is. Or vice versa. There might be other ways but I'm not entirely sure. Hope this helps!
@@WittCode it does work however with an inconvenience. it does not save the files or pic's.
@@kristanbottjer8001 it doesn't save the files when you use another thread? It does when you run it normally though right?
What changes do I need to make to send multiple files?
Hey there! You can send as many files as you want! No changes needed 🤠
Hey how to transfer folders?
would you please upload the source code for this program
i am facing ana error C:\Users\PC\IdeaProjects\client bhanu\src\client3.java:9:8
java: class Client is public, should be declared in a file named Client.java
Hey there! It seems like you created a class called Client in a file where the name is not Client.java? It seems like you might have named it Client3.java. Make sure the name of the class and file match!
I have one more issue can we open file directly means when the file recive at server side it get open automatically
I can't find the code
i have done everything correctly except for the server code . someone please help
nevermind i got it
yes can we put a chat within?
Hey there! You most certainly can! However this wouldnt be an easy addition. I'll be making a video on a messenger like that in the future 🤠
where i can download the code?
Sorry but I never pushed this to a repo and the computer I coded it on broke :(
Can we create the booking system using this socket programming?
Hey there! Sorry but can you explain the booking system to me or give me more details?
@@WittCode for example, i like to create a reservation system for hotel. So the server will calculate the price arh sent back to the client, and the client can download the receipt.. That's what I think.. Thanks WittCode
@@kumak9890 This could definitely be made this way! Im not sure if it is the best way but you could get the values from the client and parse them and then create a file on the server with the calculated values and send it back to the user just like in this video! Maybe an email would be better for something like this?
@@WittCode exactly..Can you explain the about the Email? Not fully understand 😅
@@kumak9890 No worries! I'll actually be making a video on how to send an email with Java at some point so that'll probably explain it best. But I would say when you get a purchase from the client parse the values and send an email receipt?
Someone is deleting my comments?....or its yt faulty?
I couldn't download the code bro😓
how can i download this code ?
Sorry bro I lost this code a while back...
Is this necessary to connect devices to same network ?
Hey Piyush! They do not need to be on the same network but you need the right connection information. You just have to pass this into the Socket constructor. 😃
Ok. But I am getting connection timed out error when trying to send the file to another devices. Can you help me with that ?
@@piyushkesharwani1987 Does the server that you are connecting to have a Public IP address or a private one?
@@WittCode Its my friend's PC
@@piyushkesharwani1987 I'm guessing your friends computer is on a private network so the router will have a public address but your friends computer will most likely be private. I am not sure how to work around this but if I do I'll let you know 🤠
can you change from localhost to public
Hey there! You can! With a socket connection you just need to provide the correct port number and IP address that you want to connect to. So you would use the target IP address as opposed to 'localhost' in the socket constructor.
@@WittCode but how we can open the address?..i just made the question one more time in some comment
but put it also here in case you have time and you want to help...
where is the code ???????????
why can't i see your code ?
What do you mean bro?
@WittCode i can’t see your source code
@@TinNguyenThanh-ko6pi oh yeah this is an old video. The laptop I wrote the code on died and was lost with it! You'll just have to copy the code in the video
Is this UDP or TCP ? Please let me know
Hey Kamrul! This project uses Java sockets which implement TCP. So the file contents should be arriving in order and checks should be in place.
Thanks a lot Brother. Best wishes to you.
Is there ftp protocol to transfer the file ?
Please send me the code
Can we send file of a particular ip address instead of local host
Hi WittCode thank you so much for your easy to understand explanation! But I'm having an issue where I try to send file to the server but nothing show up in the Server Jframe.
Here is the link of the code that I have done: docs.google.com/document/d/19OFc0GoOcXTWs7APUwvJAHf1wJJK4tKPp9eZq_vPMrc/edit?usp=sharing.
BTW, What IDE are you using? Can you give me a download link?
would you please upload the source code for this program