[Zerofile-svn] SF.net SVN: zerofile: [29] trunk/src
Status: Pre-Alpha
Brought to you by:
karl-bengtsson
|
From: <kar...@us...> - 2007-11-06 16:47:38
|
Revision: 29
http://zerofile.svn.sourceforge.net/zerofile/?rev=29&view=rev
Author: karl-bengtsson
Date: 2007-11-06 08:17:15 -0800 (Tue, 06 Nov 2007)
Log Message:
-----------
Further expanded methods in ZeroconfRegistration class
Modified Paths:
--------------
trunk/src/ZeroFile.java
trunk/src/ZeroconfRegistration.java
Modified: trunk/src/ZeroFile.java
===================================================================
--- trunk/src/ZeroFile.java 2007-11-06 15:49:52 UTC (rev 28)
+++ trunk/src/ZeroFile.java 2007-11-06 16:17:15 UTC (rev 29)
@@ -1,4 +1,4 @@
-import java.net.ServerSocket;
+//import java.net.ServerSocket;
public class ZeroFile {
/**
@@ -10,8 +10,11 @@
try
{
// Let system allocate us an available port to listen on
- ServerSocket s = new ServerSocket(0);
- ZeroconfRegistration.registerService(s.getLocalPort());
+ //ServerSocket s = new ServerSocket(0);
+ //ZeroconfRegistration.registerService(s.getLocalPort());
+ ZeroconfRegistration.registerService();
+ ZeroconfRegistration.set1st("Testar");
+ ZeroconfRegistration.setLast("Nisse");
Thread.sleep(5000);
ZeroconfRegistration.setStatus("dnd");
Thread.sleep(15000);
Modified: trunk/src/ZeroconfRegistration.java
===================================================================
--- trunk/src/ZeroconfRegistration.java 2007-11-06 15:49:52 UTC (rev 28)
+++ trunk/src/ZeroconfRegistration.java 2007-11-06 16:17:15 UTC (rev 29)
@@ -31,24 +31,27 @@
});
_txtRecord.set("txtvers", "1");
_txtRecord.set("status",status);
- //_txtRecord.set("email","tes...@te...");
- //_txtRecord.set("jid","te...@te...");
_txtRecord.set("vc","SDUR!XN");
_txtRecord.set("port.p2pj",Integer.toString(port));
- //_txtRecord.set("1st","Nisse");
- //_txtRecord.set("last","Nilsson");
_r.getTXTRecord().update(0, _txtRecord.getRawBytes(), 0);
}
static void registerService(int port)
- throws DNSSDException, InterruptedException
+ throws DNSSDException, InterruptedException
{
ZeroconfRegistration.registerService("avail",port);
}
+ static void registerService()
+ throws DNSSDException, InterruptedException
+ {
+ ZeroconfRegistration.registerService(5222);
+ }
+
static void unregisterService()
{
_r.stop();
+ System.out.println("Deregistered service");
}
static String getStatus()
@@ -57,7 +60,7 @@
}
static void setStatus(String s)
- throws DNSSDException, InterruptedException
+ throws DNSSDException, InterruptedException
{
if (_r != null)
{
@@ -65,4 +68,63 @@
_r.getTXTRecord().update(0, _txtRecord.getRawBytes(), 0);
}
}
+
+ static String getEmail()
+ {
+ return _txtRecord.getValueAsString("email");
+ }
+
+ static void setEmail(String e)
+ throws DNSSDException, InterruptedException
+ {
+ if (_r != null)
+ {
+ _txtRecord.set("email",e);
+ _r.getTXTRecord().update(0, _txtRecord.getRawBytes(), 0);
+ }
+ }
+
+ static String getJID()
+ {
+ return _txtRecord.getValueAsString("jid");
+ }
+
+ static void setJID(String jid)
+ throws DNSSDException, InterruptedException
+ {
+ if (_r != null)
+ {
+ _txtRecord.set("jid",jid);
+ _r.getTXTRecord().update(0, _txtRecord.getRawBytes(), 0);
+ }
+ }
+
+ static String get1st()
+ {
+ return _txtRecord.getValueAsString("1st");
+ }
+
+ static void set1st(String First)
+ throws DNSSDException, InterruptedException
+ {
+ if (_r!=null)
+ {
+ _txtRecord.set("1st",First);
+ _r.getTXTRecord().update(0, _txtRecord.getRawBytes(), 0);
+ }
+ }
+ static String getLast()
+ {
+ return _txtRecord.getValueAsString("Last");
+ }
+
+ static void setLast(String Last)
+ throws DNSSDException, InterruptedException
+ {
+ if (_r!=null)
+ {
+ _txtRecord.set("Last",Last);
+ _r.getTXTRecord().update(0, _txtRecord.getRawBytes(), 0);
+ }
+ }
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|