Basic usage of php sockets and encryption algorithm