if(@BUFFER > 0){ # do something open socket sending something close socket }