To be honest, I believe it wasn't being placed in the right area of the code.
Can you show me what you mean?
I'm a complete noob when it comes to this, I've never had to deal with TCP sockets like this -reading and writing a file is as close as I've gotten to this :>