src/jlibrtp/ValidateParticipantDatabase.java
changeset 214 2bf440c54ca5
parent 213 9bdff6cbd120
child 215 5db64229be69
equal deleted inserted replaced
213:9bdff6cbd120 214:2bf440c54ca5
     1 /**
       
     2  * Java RTP Library (jlibrtp)
       
     3  * Copyright (C) 2006 Arne Kepp
       
     4  * 
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Lesser General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2.1 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Lesser General Public License for more details.
       
    14  * 
       
    15  * You should have received a copy of the GNU Lesser General Public
       
    16  * License along with this library; if not, write to the Free Software
       
    17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
       
    18  */
       
    19 package jlibrtp;
       
    20 
       
    21 import java.net.DatagramSocket;
       
    22 import java.net.InetAddress;
       
    23 
       
    24 public class ValidateParticipantDatabase {
       
    25 
       
    26 	/**
       
    27 	 * @param args
       
    28 	 */
       
    29 	public static void main(String[] args) {
       
    30 		DatagramSocket rtpSocket = null;
       
    31 		DatagramSocket rtcpSocket = null;
       
    32 		try {
       
    33 			rtpSocket = new DatagramSocket(6002);
       
    34 			rtcpSocket = new DatagramSocket(6003);
       
    35 		} catch (Exception e) {
       
    36 			System.out.println("RTPSession failed to obtain port");
       
    37 		}
       
    38 		RTPSession rtpSession = new RTPSession(rtpSocket, rtcpSocket);
       
    39 		
       
    40 		ParticipantDatabase partDb = new ParticipantDatabase(rtpSession);
       
    41 		
       
    42 		Participant part0 = new Participant("127.0.0.1", 4545, 4555);
       
    43 		Participant part1 = new Participant("127.0.0.1", 4546, 4556);
       
    44 		Participant part2 = new Participant("127.0.0.1", 4547, 4556);
       
    45 		
       
    46 		partDb.addParticipant(0,part0);
       
    47 		partDb.addParticipant(0,part1);
       
    48 		partDb.addParticipant(0,part2);
       
    49 		
       
    50 		partDb.debugPrint();
       
    51 		
       
    52 		System.out.println("********************* Removing Participant 1 (4546) ***********************");
       
    53 		partDb.removeParticipant(part1);
       
    54 		partDb.debugPrint();
       
    55 
       
    56 		
       
    57 		InetAddress inetAdr = null;
       
    58 		try { inetAdr = InetAddress.getByName("127.0.0.1"); } catch (Exception e) { };
       
    59 		
       
    60 		//Participant part3 = partDb.getParticipant(inetAdr);
       
    61 		//part3.ssrc = 12345678;
       
    62 		System.out.println("********************* Updating Participant 3 (4546) ***********************");
       
    63 		//partDb.updateParticipant(part3);
       
    64 		
       
    65 		partDb.debugPrint();
       
    66 	}
       
    67 
       
    68 }