Why socket is not execute successfully? :     public boolean connection(View view)
        {
            boolean x=true;
            try
            {
                serverSocket= new ServerSocket(9999);
                socket = serverSocket.accept();
                Toast.makeText(creator.this,"ServerStarted,",Toast.LENGTH_SHORT).show();
                C.setEnabled(true);
                
            } catch (IOException e)
            {
                Toast.makeText(creator.this,"Server is not Started,",Toast.LENGTH_SHORT).show();
                e.printStackTrace();
                x=false;
            }
            return x;
        }

//, when this function is going to execute, app stops working
//why socket.accept(); is not allowed there