[sip-comm-cvs] CVS update: /sip-communicator/src/net/java/sip/communicator/impl/netaddr/SharedDatagramSocketImpl.java

emcho at dev.java.net emcho at dev.java.net
Tue May 15 11:00:24 CEST 2007


User: emcho   
Date: 2007-05-15 09:00:24+0000
Log:
 refactoring - moving version and keepalive jabber extensions to their own packages in impl.provider.jabber.extension

File Changes:

Directory: /sip-communicator/src/net/java/sip/communicator/impl/netaddr/
========================================================================

File [added]: SharedDatagramSocketImpl.java
Url: https://sip-communicator.dev.java.net/source/browse/sip-communicator/src/net/java/sip/communicator/impl/netaddr/SharedDatagramSocketImpl.java?rev=1.1&content-type=text/vnd.viewcvs-markup
Added lines: 67
---------------
package net.java.sip.communicator.impl.netaddr;

import java.net.*;
import java.io.IOException;

/**
 * <p> </p>
 *
 * <p> </p>
 *
 * <p> </p>
 *
 * <p> </p>
 *
 * @author Emil Ivov
 */
public class SharedDatagramSocketImpl
    extends DatagramSocket
{
    private DatagramPacket ourPack = null;
    private DatagramSocket encapsulatedSocket = null;

    SharedDatagramSocketImpl()
        throws java.net.SocketException
    {
        super();
        encapsulatedSocket = new DatagramSocket();
    }

    public void receive(DatagramPacket pack)
        throws IOException
    {

        if(ourPack == null)
        {
            ourPack = new DatagramPacket(pack.getData(), pack.getLength() );
            synchronized (ourPack)
            {
                try
                {
                    ourPack.wait();
                }
                catch (InterruptedException ex)
                {
                    ex.printStackTrace();
                }
            }
            super.receive(pack);
        }
    }

    private class SocketReceiveThread extends Thread
    {
        public void run()
        {
            try
            {
                encapsulatedSocket.receive(ourPack);
            }
            catch (IOException ex)
            {
            }

        }
    }

}




---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: cvs-help at sip-communicator.dev.java.net





More information about the commits mailing list