• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

name of file

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I transfer a file from a client to a server. It works fine. But the client transfer only data. How can I solve transfer with name of file?(I use ServerSocket, Socket, OutputStream, InputStream)

Thanks for your help
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does "transfer with name of file" mean?. What else is there to transfer except for the data of the file (which you said works fine)?
 
manu chaox
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
What does "transfer with name of file" mean?. What else is there to transfer except for the data of the file (which you said works fine)?




I transfer only data of file without filename. File > FileInputStream > BufferedInputStream > .... via OutputStream to net(tcp)

For example:
client binary.bin ... transfer file from parameter

but on server side I create my own name of file. I don't know how get filename of file which is send by client.
 
manu chaox
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by manu chao:



I transfer only data of file without filename.

Client : File > FileInputStream > BufferedInputStream > .... via OutputStream to net(tcp)

For example:
client binary.bin ... transfer file from parameter

but on server side I create my own name of file. I don't know how get filename of file which is send by client.

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before sending the data, can you send the file name over the same stream, with some pre-determined marker to separate the file name from the file data?
 
manu chaox
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
Before sending the data, can you send the file name over the same stream, with some pre-determined marker to separate the file name from the file data?



Yes, I can. And is it the best way?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's hard to say without knowing the circumstances. So far we only know that you have a single stream to work with.
 
manu chaox
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
That's hard to say without knowing the circumstances. So far we only know that you have a single stream to work with.



I tried solution sending filename in first block.

But is it possibility to use ObjectInputStream, ObjectOutputStream for sending filename by any way?

Client:
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do you want to use object streams?
 
reply
    Bookmark Topic Watch Topic
  • New Topic