--- a/src/org/sipdroid/net/SipdroidSocket.java Sat Jan 23 22:19:43 2010 +0100
+++ b/src/org/sipdroid/net/SipdroidSocket.java Sun Jan 24 00:42:29 2010 +0100
@@ -18,7 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-package src.org.sipdroid.net;
+package org.sipdroid.net;
import java.io.IOException;
import java.net.DatagramPacket;
@@ -33,57 +33,58 @@
public class SipdroidSocket extends DatagramSocket {
- PlainDatagramSocketImpl impl;
- public static boolean loaded = false;
-
- public SipdroidSocket(int port) throws SocketException, UnknownHostException {
- super(!loaded?port:0);
- if (loaded) {
- impl = new PlainDatagramSocketImpl();
- impl.create();
- impl.bind(port,InetAddress.getByName("0"));
- }
- }
-
- public void close() {
- super.close();
- if (loaded) impl.close();
- }
-
- public void setSoTimeout(int val) throws SocketException {
- if (loaded) impl.setOption(SocketOptions.SO_TIMEOUT, val);
- else super.setSoTimeout(val);
- }
-
- public void receive(DatagramPacket pack) throws IOException {
- if (loaded) impl.receive(pack);
- else super.receive(pack);
+ PlainDatagramSocketImpl impl;
+ public static boolean loaded = false;
+
+ public SipdroidSocket(int port) throws SocketException, UnknownHostException {
+ super(!loaded?port:0);
+ if (loaded) {
+ impl = new PlainDatagramSocketImpl();
+ impl.create();
+ impl.bind(port,InetAddress.getByName("0"));
}
-
- public void send(DatagramPacket pack) throws IOException {
- if (loaded) impl.send(pack);
- else super.send(pack);
- }
-
- public boolean isConnected() {
- if (loaded) return true;
- else return super.isConnected();
- }
-
- public void disconnect() {
- if (!loaded) super.disconnect();
+ }
+
+ public void close() {
+ super.close();
+ if (loaded) impl.close();
+ }
+
+ public void setSoTimeout(int val) throws SocketException {
+ if (loaded) impl.setOption(SocketOptions.SO_TIMEOUT, val);
+ else super.setSoTimeout(val);
+ }
+
+ public void receive(DatagramPacket pack) throws IOException {
+ if (loaded) impl.receive(pack);
+ else super.receive(pack);
+ }
+
+ public void send(DatagramPacket pack) throws IOException {
+ if (loaded) impl.send(pack);
+ else super.send(pack);
+ }
+
+ public boolean isConnected() {
+ if (loaded) return true;
+ else return super.isConnected();
+ }
+
+ public void disconnect() {
+ if (!loaded) super.disconnect();
+ }
+
+ public void connect(InetAddress addr,int port) {
+ if (!loaded) super.connect(addr,port);
+ }
+
+ static {
+ try {
+ System.loadLibrary("OSNetworkSystem");
+ OSNetworkSystem.getOSNetworkSystem().oneTimeInitialization(true);
+ SipdroidSocket.loaded = true;
+ } catch (Throwable e) {
+ e.printStackTrace();
}
-
- public void connect(InetAddress addr,int port) {
- if (!loaded) super.connect(addr,port);
- }
-
- static {
- try {
- System.loadLibrary("OSNetworkSystem");
- OSNetworkSystem.getOSNetworkSystem().oneTimeInitialization(true);
- SipdroidSocket.loaded = true;
- } catch (Throwable e) {
- }
- }
+ }
}