in reply to is the socket done or not?

I'm not sure, but this looks strange:
while (<$client>) { # fetch based on newlines ... @segments = split /\015/, $message;
So your code is expecting multiple lines (terminated by standard newlines) and is then splitting each "line" into different segments delimited by \r's ? That just seems weird. Be sure that $/ is what you expect it to be (so that <$client> works). If you need this to be more of a binary type of protocol, consider using sysread directly, read your data in binary chunks, and *then* split on your delimiter (making sure to keep the trailing bit around for the next time you read data, in case you get a partial command).