StreamingSocket and datagram Socket problem


Hey , 

I am creating an application using juce with embedded webserver , so i am scanning for open ports on machine and launch webserver on it. I am doing this but doesnt seem to be working :

        bool connectionMade = false;
        while (( !connectionMade) && (_openPort < 65535))

          ScopedPointer<StreamingSocket>  _socket = new StreamingSocket();



          connectionMade = _socket->bindToPort(_openPort);

          if(connectionMade == false)






Also tried using the UDP same problem , it returns false connect or bind, using the latest libraries:

while (( !connectionMade) && (_openPort < 65535))
            ScopedPointer<DatagramSocket>    _socket = new DatagramSocket(_openPort,false);
            //    ScopedPointer<DatagramSocket> _socket = new DatagramSocket(_openPort); // chcekingfor open port
            //_openPort = _socket->getPort();
           bool connectionMade = _socket->isConnected();
            _ports = String(_openPort);



_ports is what i pass to webserver .





What port number are you trying? Ports below 1024 have permissions problems. If you haven't already, try above 1024. 8080 is a common 'alternate webserver port' for this reason.

By the way, don't those function get stuck in infinite loops? Don't you mean 'if' not 'when' at the start of each?





I was trying above 1024 till 65535, The reason for searching open ports was in case the 8080 is acquired by some other webserver as i have embedded webserver in application . So was scaning port if its already occupied then use diff , else thsi one. Well in the end had to write native code.




Your scopedpointer is deleting your new StreamingSocket() every loop recursion, i can use websockets, but i must initiate them, and let them be... not killing them every loop !