All pastes #351569 Raw Edit

Something

public text v1 · immutable
·published 2007-02-12 06:56 UTC
rendered paste body
  class setupButtonListener implements ActionListener{
    public void actionPerformed(ActionEvent e){

      System.out.println("Setup Button pressed !");      

      if (state == INIT) 
      {
	  //init RTSP sequence number
	  RTSPSeqNb = 1;
	 
	  //Send SETUP message to the server
	  send_RTSP_request("SETUP");

	  	//Wait for the response 
	  	if (parse_server_response() != 200)
	  		System.out.println("Invalid Server Response");
	  	else
	  	{
	      //change RTSP state and print new state 
	      state = READY;
	      
	      try{
	    	  RTPsocket = new DatagramSocket(RTP_RCV_PORT); //open RTP socket
	    	  RTPsocket.setSoTimeout(5); //set timeout to 5ms
	      }
	      catch(SocketException f) {
	    	  System.out.println("Socket on RTP_RCV_PORT could not be opened or UDP error!");
	      }
	      
	      System.out.println("New RTSP state: READY");
	    }
      }//else if state != INIT then do nothing
    }
  }