• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to maintain several UDP paths?

 
Shiham Nawaz
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm coding a chat application (using UDP)which communicates through a chat server. I need to uniquely identify the communication path between the workstations involved in a end-to-end chat(through the server)session.

Pls advise me in this regard, as to how i can identify a particular communication session in UDP

Thank you.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I understand the question correctly, you can use the getSocketAddress() method of the DatagramPacket object to uniquely identify the source.
Bill
 
Shiham Nawaz
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
yes, this is correct incase i'm using just a 2 tier arhitecture and the communication is between the client and server. But my case is, a client communicates with another client through the server. And i need the server to monitor a particular session as there will be many "client to client" sessions through the server.
In TCP this could be easily done, but i want to use UDP, and i cant seem to uniquely maintain a particular session. I cant seem to get the logic behind this.
I need to recognize a particular session because, i want to dynamically add more clients to a particular session(something like conferencing).

Pls help me with this regard
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each message packet of bytes must contain routing information so the server can send it to the correct client(s).

You need to come up with a design for a standard fixed block of data that will be transmitted with each packet in addition to the variable chat data. Since this is UDP, each packet must stand alone AND the application can not break if a packet is lost.

Taking the anthropomorphic approach, imagine that you are the server getting a single slip of paper at a time - what do you need to know to send it to the right recipient?

It is an interesting problem, please let us know what you come up with.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic