Results 1 to 3 of 3
- 11-06-2007, 07:38 PM #1
Senior Member
- Join Date
- Nov 2007
- Posts
- 115
- Rep Power
- 0
Socket programming - accepting files
I have written a Socket Server that is listening at some port. I am getting input from my client using DataInputStream. Review the code below:
I want the user to send me File objects as well. Is this possible which the code above or I have to make some changes?Java Code:DataInputStream input; try { input = new DataInputStream(MyClient.getInputStream()); } catch (IOException e) { System.out.println(e); }
Thanks for your time.
- 11-29-2007, 10:38 AM #2
Member
- Join Date
- Nov 2007
- Posts
- 12
- Rep Power
- 0
Yes, you may send files using Socket client. use FileOutputStream in that case.
Make sure to catch exceptions.Java Code:BufferedOutputStream bos = new BufferedOutputStream (new FileOutputStream("fileName.txt"));
Happy coding.
- 11-29-2007, 10:40 AM #3
Senior Member
- Join Date
- Nov 2007
- Posts
- 115
- Rep Power
- 0
Similar Threads
-
Socket programming - port issues
By ravian in forum NetworkingReplies: 2Last Post: 11-07-2007, 10:24 AM -
Programming Socket Question
By paul in forum NetworkingReplies: 1Last Post: 07-30-2007, 07:26 PM -
send files through socket
By bbq in forum Advanced JavaReplies: 1Last Post: 06-05-2007, 02:08 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks