Hi all,
This code I got from the Sun site on datagrams.
I stripped it to the extent that only relevant code (I think) is included.
I'm doing it one step at a time else I'll just get drowned with too much info beyond what I can chew.
In the code below I can see that it responds to the client (lets call it MachineA) that sends a message.
Now, this time, I also want to be able to send the same message (for now) to another client (let's call it MachineB). I don't know how I could do this. Please feel free to modify the code.
I also put the reading and sending in a while loop, that loops indefinitely. I don't know if this is the correct way of doing it. I want the Server to indefinitely listen for, receive messages from machineA, acknowledge the messages from MachineA, and send messages to machineB. If it's not the right way, again, please feel free to modify the code.
The server only sends messages to MachineB only after translating the message received from MachineA. Again, just for this demonstration, I just need to forward the same message to MachineB.
This is the flow of messages (assuming all packets are valid):
Listen for packet...
MachineA ---send message---> TestServerMain
MachineA <---acknowledge----- TestServerMain
After the acknowledgement, MyServer translates the message received from MachineA
Then...
TestServerMain----send translated message----> MachineB
Go back and listen for packet.
Also, when the application is terminated, will the socket actually close, as the socket.close() is inside the while loop.
Thanks you.

Karen