Thanks a lot for your reply, ambrus.
I will try to mix Socket with IO::Handle and see the result.
The other code the server part is in fact reused from previous project which is proved to run very well with other client codes (in C language of course).