And, if you are planning to use the above logic for multiple files at one time, you should make the variable 'loadData' a field inside of EDV. Otherwise, multiple sockets being active will corrupt the value if onData is called for different sockets at the same time.