Results 1 to 8 of 8
- 10-11-2011, 08:24 AM #1
Member
- Join Date
- Sep 2011
- Posts
- 12
- Rep Power
- 0
diffrent output/input streams in same socket connection
hello,
I am trying to send file and then function arguments through same socket connection but in diffrent output streams.( Sending file by fileoutoutstream and arguments by dataoutputstream),,,, but at other end both type of data is being collected in same fileinputstream only and m getting EOFexception ,,, please suggest me how can i resolve this????
Thanks!
- 10-11-2011, 10:11 AM #2
Member
- Join Date
- Feb 2011
- Location
- Ahmedabad
- Posts
- 36
- Rep Power
- 0
Re: diffrent output/input streams in same socket connection
EOF exception comes when u have reached at the end of file and still try to read it sol after reaching at the end of file you need to move further so you can catch that exception in catch block as follow
Java Code:try{ //code to read content } catch(EOFException e){ s.o.p.("end of file reached"); } //further processing codeHemant Metalia
cool-.gif)
- 10-11-2011, 10:32 AM #3
Member
- Join Date
- Sep 2011
- Posts
- 12
- Rep Power
- 0
Re: diffrent output/input streams in same socket connection
thanks for the reply Hemant....
Yes there is more data to read after EOF but this is my next data,,, i need to collect the data after EOF in new variables,, actually i think both type of data is coming in same packet ,,,, please suggest me how can i send the data in different packets while sending.
I have handeled the exception but it doesnt resolve my problem,,,
- 10-11-2011, 01:35 PM #4
Member
- Join Date
- Feb 2011
- Location
- Ahmedabad
- Posts
- 36
- Rep Power
- 0
Re: diffrent output/input streams in same socket connection
Hi ketan
as you are using same stream for both file when you transfer data of files in between it so sends the eof character at the end of first file so when you try to receive it it also receives eof character so it throws eofexception so you can handle it at the time of sending data if there is an eof character do not send it into stream.
Hemant Metalia
cool-.gif)
- 10-11-2011, 01:50 PM #5
Member
- Join Date
- Sep 2011
- Posts
- 12
- Rep Power
- 0
Re: diffrent output/input streams in same socket connection
with this at the receiving end, all the data will go in same file as both type of data is goin in same stream,,,, my motive is to send different data in different packets....
- 10-11-2011, 02:32 PM #6
Member
- Join Date
- Feb 2011
- Location
- Ahmedabad
- Posts
- 36
- Rep Power
- 0
Re: diffrent output/input streams in same socket connection
you can put some separator after every end of data at the time of sending and at the time of receiving you can check for the separator and put it in new variable
Hemant Metalia
cool-.gif)
- 10-11-2011, 03:35 PM #7
Member
- Join Date
- Sep 2011
- Posts
- 12
- Rep Power
- 0
Re: diffrent output/input streams in same socket connection
its done, using ObjectOutputStream class.... sent data after packing in a object.
Thanks Hemant for ur valuable replies :)
- 10-11-2011, 03:41 PM #8
Member
- Join Date
- Feb 2011
- Location
- Ahmedabad
- Posts
- 36
- Rep Power
- 0
Similar Threads
-
Socket, streams and data types?
By Tomtefaen in forum NetworkingReplies: 0Last Post: 01-14-2011, 11:36 PM -
Using input and output streams for remote interprocess communication
By subhayan in forum NetworkingReplies: 7Last Post: 02-24-2010, 08:00 PM -
output streams
By andre1011 in forum NetworkingReplies: 1Last Post: 03-24-2009, 08:18 AM -
ObjectInput/Output Streams
By Rhesus21 in forum NetworkingReplies: 3Last Post: 07-30-2008, 01:26 AM -
Runtime.exec(), handling input and output streams
By crookshank in forum New To JavaReplies: 0Last Post: 06-05-2008, 02:41 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks