File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Transfer file by socket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Transfer file by socket" Watch "Transfer file by socket" New topic

Transfer file by socket

Ivan Silva

Joined: Dec 18, 2009
Posts: 10

Someone can help me. I want transfer files by socket (any file). I thought in use a class of hierarchy of InputStream, but I encontered only the method avaliable() where this return an int with size of archieve. I believe that I have use an array of bytes to pass by socket but how I will get bytes ?


Ivan Rodrigues
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Welcome to JavaRanch.

You'd use a FileInputStream to read the bytes of the file into a byte[].
Ivan Silva

Joined: Dec 18, 2009
Posts: 10
Ulf Dittmer tks...., I succed do this operation!!!

I agree. Here's the link:
subject: Transfer file by socket
It's not a secret anymore!