aboutsummaryrefslogtreecommitdiffstats
path: root/src/jake2/qcommon
diff options
context:
space:
mode:
authorCarsten Weisse <[email protected]>2004-10-17 20:33:18 +0000
committerCarsten Weisse <[email protected]>2004-10-17 20:33:18 +0000
commitacd23027524869949409a8f84b1c13dcd4bc9c97 (patch)
treec396a857220c99804e9566f553bdde1beb3b55b1 /src/jake2/qcommon
parentfc066112b645e79463b914e4c633f793fdba487d (diff)
nonblocking network and code cleanup
Diffstat (limited to 'src/jake2/qcommon')
-rw-r--r--src/jake2/qcommon/netadr_t.java25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/jake2/qcommon/netadr_t.java b/src/jake2/qcommon/netadr_t.java
index 47ec5a8..72473d7 100644
--- a/src/jake2/qcommon/netadr_t.java
+++ b/src/jake2/qcommon/netadr_t.java
@@ -19,9 +19,11 @@
*/
// Created on 27.11.2003 by RST.
-// $Id: netadr_t.java,v 1.3 2004-10-17 20:20:09 cawe Exp $
+// $Id: netadr_t.java,v 1.4 2004-10-17 20:33:18 cawe Exp $
package jake2.qcommon;
+import jake2.Defines;
+
import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -31,16 +33,27 @@ public class netadr_t {
public int port;
- public byte ip[] = { 0, 0, 0, 0 };
-
- //public byte ipx[] = new byte[10];
+ public byte ip[];
InetAddress ia = null;
+ public netadr_t() {
+ this.type = Defines.NA_LOOPBACK;
+ this.port = 0; // any
+ try {
+ this.ip = InetAddress.getByName("localhost").getAddress();
+ } catch (UnknownHostException e) {
+ }
+ }
+
public InetAddress getInetAddress() throws UnknownHostException {
- if (ia == null)
+ if (type == Defines.NA_BROADCAST) {
+ ia = InetAddress.getByName("255.255.255.255");
+ } else if (type == Defines.NA_LOOPBACK) {
+ ia = InetAddress.getByName("localhost");
+ } else if (ia == null) {
ia = InetAddress.getByAddress(ip);
-
+ }
return ia;
}