Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trasferring files over sockets

Status
Not open for further replies.

Sedai

Programmer
Mar 4, 2001
158
US
hi!

How can i transfer a file over a socket?

I thought it would be pretty straightforward, but I couldn't think of any way.
The FileInputStream class cannot be wrapped around a socket, quite naturally, the way a DataInputStream can.

Any help would be greatly appreciated.


Avendeval


 
You can easily get the Socket's input and output stream with Socket.getInputStream() and Socket.getOutputStream(). You can then feed a FileOutputStream with the Socket's InputStream or feed the Socket's OutputStream with your FileInputStream.

Make sense?
 
i usually bind the in out stream of socket to a zip stream ;)

just a thought

Dix
 
Thanks. So it IS that easy after all ;)
Will play with it and see what happens.

THANKS wushutwist and DixieFlatline Avendeval


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top