Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending file name

 
Sophie Jo
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sending a file via tcp/ip it's a combo of a ftp program and a tcp.ip program. I have no errors.

However i would like to send the file name, as a String, without the path to the client. e.g c:\my doc\a.txt i would like it to be sent as a.txt.

I tried using a loop, but aside from the logical errors that incurrs, when the data is read out there is still a 'null' value infront of it.

Is there another way?

Would be greatful for any ideas.

Thanks.
[ May 16, 2004: Message edited by: Sophie Jo ]
 
Jose Botella
Ranch Hand
Posts: 2120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try sending to the OutputStream, first a long for the length of the file, then a short for the length of the file name, then the bytes for the name of the file, and finally bytes that are the actual file content.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!