First at all, i want it to be bidirecional. So shutdown() does not serve to me until now. About your security question you have said that server does no require authentication. It is not right, the server is running as port knocking, in other words it does not open any port until it recieves (from client) the correct sequence of udp packets (Net::RawIP and Net::PcapUtils) from correct source ip:port(s). So it is a way of authentication. Lately i will use some kind of user/password and SSL i guess. Im still beginning to code it and i just can get over after fix these bugs.