How to insure close chaneel after unexpect error ?



Hi everyone

My program work in three platform (windows,UNIX and LINUX). every
client program must access one share

directory to operate text file.

Some error somtimes hapened in the unstable network connection!

Q1 in the windows side text file will be locked by unexpect network
disconnect occured, the text can't be operate after administrator to
release the permission!

How can I insure the file operation will wait for all data tranfer
complete(even the network disconnet temporary)?

Q2 the UNIX system the open channel(open a file to write in share
directory) can be delete by file delete without any alert (window side
will show the permission denied,UNIX side will delete without any
alert) ???


Could some some give me some example to solve the pipe issue?

BR
Rolance
.