• 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

reading files as bytes and sending them as bytes

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am trying to build a client server application using java Sockets i have a directory on the server (C:\Patches), how can i read the files in the Patches directory as bytes and transfer them over to the client as bytes. i mean packets of bytes.
please somebody help me. thanks
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, this is an awfully generic question. If you're just wondering about how to transfer the raw contents of the files, then just avoid using Readers or Writers; use InputStreams and OutputStreams, and all your data will be transferred as the raw, unadulterated file contents.

If you're asking how to open files, how to do networking, etc, well, you'll have to ask those one at a time. Or you could checkout the networking and I/O sections of Sun's Java Tutorial. You can then come back here with specific questions.
 
Masoud shirzay
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have already got the client server connecton working, i can send and receive messages from client to server, i dont have problem with the networking side of the program. I have Microsoft Patches in C:\Patches folder, which i want to transfer (the patches itself, not the contents of the file). i dont know how to read them as bytes.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic