You create a new connection for each file. If $1 contains the correct string, that means the server is sending the response that's meant for one connection to an entirely unrelated connection. A server bug.
PS — $sock is a socket, so you can use it with <> (e.g. local $/; <$sock>) just like you did before you switched to IO::Socket::INET.
In reply to Re^7: Socket buffer issue
by ikegami
in thread Socket buffer issue
by goosesganders
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |