java send file over socket code example
Example: java transfer file over socket
Socket socket = new Socket() ; //Open a socket with the server
OutputSteam opt = socket.getOutputStream ; // get the outputStream of the socket
// so we can write in it
File file = new File(" Path of the file you want to send ") ;
FileInputStream fis = new FileInputeStream(file) ;
byte[] data = new byte[ 1024 * 16 ] ;
int count ;
while( (count = fis.read(data)) > 0){
opt.write(data , 0 , count) ;
}