Multicast Client System for iOS with a Java Server-Side -


context:

i creating cross-platform multicast client-server system mobile. have created server side in java. created android client side , works perfectly.

what want know:

i want know if create client side in ios using listener program in example http://ntrg.cs.tcd.ie/undergrad/4ba2/multicast/antony/example.html compatible server-side created in java.

if above example not work there way can still use java server-side , create native ios client system compatible java server-side?

sample code of java server side reference:

import java.net.datagrampacket; import java.net.inetaddress; import java.net.multicastsocket; //more imports...  class server2 {      public static multicastsocket ms1;      public static void main(string[] args) throws ioexception {              try {                 inetaddress sessaddr1 = inetaddress.getbyname("224.2.76.24");                 ms1 = new multicastsocket(5500);                 ms1.joingroup(sessaddr1);                   while(true) {                     byte[] message = new byte[1024];                     message = getipaddress().getbytes();                      datagrampacket dp = new datagrampacket(message, message.length, sessaddr1, 5500);                     ms1.send(dp);                                    system.out.println(string.format("sent message: %s", message));                      thread.sleep(1000);                 }             } catch (exception e) {                 system.out.println(string.format("error: %s", e));             }          }      public static string getipaddress() {         inetaddress ip;          try {             ip = inetaddress.getlocalhost();             return(string.format("%s",ip.gethostaddress()));              } catch (exception e) {             return("false");         }     } } 

i tested listener code in link , worked perfectly.

should not problem. ios posix compliant , objective-c defined on top of ansi c, paste code linked minor modifications straight project, build simple wrapper objective-c , app should compile, run , work desired.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -