c# - Error :MultiThreaded client-server application -
this question has answer here:
- filestream locked file 4 answers
i developing multithreaded client-server application in vb.net, multiple client connect 1 server,there process in server side open xml file , write data. after 1 hrs got following error:
"file used proccess."
is there suggestion side,for above issue. please check below code reading xml
public function isrecordexitsinxml(byval pfilepath string, byval pclientip string, byval pmacaddress string) dim xmldoc xmldocument = nothing dim xmlpupilnode xmlnode = nothing dim xmlagenode xmlnode = nothing try dim filename string = pfilepath isrecordexitsinxml = nothing xmldoc = new xmldocument xmldoc.load(filename) xmlpupilnode = xmldoc.selectsinglenode("//rfidreader[hostipaddress = '" & pclientip.trim & "' , macaddress = '" & pmacaddress & "' , status=1] ") if not xmlpupilnode nothing xmlagenode = xmlpupilnode.selectsinglenode("regdatetime") if not xmlagenode nothing xmlagenode.innertext = datetime.now.tostring() xmldoc.save(filename) isrecordexitsinxml = true end if else isrecordexitsinxml = false end if xmldoc = nothing xmlpupilnode = nothing xmlagenode = nothing catch ex exception xmldoc = nothing xmlpupilnode = nothing xmlagenode = nothing isrecordexitsinxml = false errorlog.writetoerrorlog(ex.message.tostring(), "hsrv-a9", "errorlog.log") xmldoc = nothing xmlpupilnode = nothing xmlagenode = nothing end try return isrecordexitsinxml end function
thanks in advance
your problem (as i'm sure aware!) when file open 1 process, cannot opened another. there possibility of using alternative medium receive data, such database? export data database xml file in 1 hit, avoiding conflict altogether.
Comments
Post a Comment