try {
dataoutput= new DataOutputStream(new BufferedOutputStream(dataSocket.getOutputStream()));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
try {
dataSocket.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return 0;
}
FileInputStream fs;
try {
fs = new FileInputStream(dir);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
try {
dataSocket.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
dataoutput.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return 0;
}
int num;
try
{
while((num=fs.read(buf)) !=-1)
{
dataoutput.write(buf, 0, num);
dataoutput.flush();
}
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
return 0;
}finally
{
try {
|