in reply to Input of a Data Stream

In order to give a full response we would need to know more. Is the data you are reading line based ? Does the app need to read from more than one connection at a time ?

Depending on what your answers are will change how many short-cuts you can take.

If this is just a simple app that reads a line based datastream from just the one socket then you can do

while(<$clientfd>) { last if /^EOS$/; # process line } close($clientfd);

But if you want to read from more than one socket at a time then you will need to use sysread and select