diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2012-08-03 10:50:43 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-08-06 10:23:10 +0100 |
commit | 98e52c47474e91dcaa5d41d8fd4925b17689fd65 (patch) | |
tree | c01b0e9f07b649ddbf5fe4f54331e0919bfa4faf /android | |
parent | cb82805c524e2d65ad75221bb50eee808c4177c8 (diff) |
Hostname transfer implemented.
Change-Id: I92f2a3c00215491b6f24d52b922a4e4f2c461637
Diffstat (limited to 'android')
-rw-r--r-- | android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java index b8ba315c4f76..5ce7897e2d0c 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/ServerFinder.java @@ -39,7 +39,7 @@ public class ServerFinder { try { String aCommand = null; - String aAddress = null; + String aName = null; System.out.println("SF:listening for packet\n"); mSocket.receive(aPacket); System.out.println("SF:received packet\n"); @@ -53,11 +53,24 @@ public class ServerFinder { if (i == aBuffer.length || !aCommand.equals("LOREMOTE_ADVERTISE")) { return; } + for (int j = i; j < aBuffer.length; j++) { + if (aPacket.getData()[i] == '\n') { + aName = new String(aPacket.getData(), i + 1, j, CHARSET); + break; + } + } + if (aName == null) { + return; + } Server aServer = new Server(CommunicationService.Protocol.NETWORK, - aPacket.getAddress().toString(), "NONAME", + aPacket.getAddress().toString(), aName, System.currentTimeMillis()); mServerList.add(aServer); + // System.out.println("SF FOUND: IP=" + // + aPacket.getAddress().toString() + " HOSTNAME=" + // + aName); + Intent aIntent = new Intent( CommunicationService.MSG_SERVERLIST_CHANGED); LocalBroadcastManager.getInstance(mContext).sendBroadcast(aIntent); |