Scenario:
- The agent listens to a certain address/port during start up.
- When server started, server will send message to agent via the address (multicast). Agent will reply the server.
How to model the first statement using UML (sequence diagram/activity/statemachine) ?
I guess any of these types of diagrams could model the interaction, but I would go with a sequence or a communication diagram for these reasons:
- there is a mix of asynchronous (the server's message) and synchronous (the agent's response) messages;
- we aren't modelling state changes either in the server or in the agent.
This would be my take on a sequence diagram for the interaction (could possibly include more agents/port listeners to show the multicast):
And on a communication diagram (Agent 0 and Agent 1 could just be called Port Listener 0 and Port Listener 1):
Statement (1), which I take to be the agent listening to the address or port, is shown as a self-call in both cases.
Here are a couple of amusing articles on sequence diagrams:
- Introduction to UML 2.0 Sequence Diagrams
- Messages in UML 2.0 Sequence Diagrams.