Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DatagramPacket with more than one group

 
Jahar Heard
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i add more than one group in DatagramPacket. I tryed with array like that..

but no success. When the array ends gives Exception java.lang.ArrayIndexOutOfBoundsException . So what is the deal here, can it be done without loop or with it, but the array to be looping throw some groups ? the str[i] contains bunch of a ip's like 255.0.0.1 and etc .
 
John Jai
Rancher
Posts: 1776
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jahar Heard wrote:



Hi i dont know about the DataGramPacket technology. But can you try modifying the for loop like below and check?



 
Jahar Heard
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lol worked ... FIxed the array error, but does anyone has information about the Packets how can i send endless groups to them i mean endless loop with groups ?
 
Arun Chidam
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jahar Heard wrote:Lol worked ... FIxed the array error, but does anyone has information about the Packets how can i send endless groups to them i mean endless loop with groups ?


what you mean by endless loop with group???
while(ture){
//will run endless, but why do you need to run endless loop?, please explain the business objective for your requirement which will help us to provide better solution
}
 
Henry Wong
author
Marshal
Pie
Posts: 20880
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By group, I am assuming that you mean multicast group. Not sure of any other networking term with "group" in it; and related to datagram packets.

Even so, "datagrampacket with more than one group" doesn't make sense. Datagrams are put on transports (even multicast transports). There is no datagram packet with groups.

We definitely need more info here.
Henry
 
Jahar Heard
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK so here is the thing i'm trying to do. PHP client to client passing through java server. I can't figure it out how can i join a multicast group in java from php client socket.. just.. Any ideas, or something that is near to my thought.
 
Henry Wong
author
Marshal
Pie
Posts: 20880
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jahar Heard wrote:OK so here is the thing i'm trying to do. PHP client to client passing through java server. I can't figure it out how can i join a multicast group in java from php client socket.. just.. Any ideas, or something that is near to my thought.


Your followup question seems simple enough -- you want to communicate with another client. What have you tried so far with the java.net.MulticastSocket class? What you described should work -- just join the same multicast group as the PHP client, and as long as the switches and routers routes the datagrams, you should be able to send and receive.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic