Hi Everyone,
I have an issue using UDP port. There are mainly two applications. Let's say application 'A' uses port 'X' to transmit packets on which application 'B' is bound to read data. Similarly application 'B' uses port 'Y' to transmit packets on which application 'A' is bound to read data. This works perfectly fine.
Now according to the requirements, I have to run two instances of application 'B' such that only one instance of application 'B' is communicating to application 'A' at a point of time. Now say that the first instance of application 'B' is 'B1' and the second as 'B2'. Then the sequence goes as:
1- 'A' opens TX port 'X' and RX port 'Y' and bind to 'Y'.
2- 'B1' opens TX port 'Y' and RX port 'X' and bind to 'X'.
3- Now both applications start communicating and transfer the data across as required.
4- When application 'B1' is done sending and receiving the data, it closes its TX and RX ports i.e. Ports 'X' and 'Y'.
5- Then 'B2' opens TX port 'Y' and RX port 'X' and bind to 'X'.
6- Now 'B2' starts communicating to application 'A'.
7- As application 'B2' is done, it closes its TX and RX ports i.e. ports 'X' and 'Y'.
8- After this, application 'B1' again needs to communicate with application 'A'. So it opens its TX port 'Y' and RX port 'X' and bind to 'X'.
Everything goes fine till here. The problem starts here.
9- Now application 'B1' sends a message to application 'A' which application 'A' successfully receives at port 'Y'.
10- In reply, application 'A' sends a message to application 'B1'. Although application 'A' writes the data successfully at port 'X' but it never reaches to application 'B1' which is waiting for the reply.
Kindly let me know the possible reason for this issue and the fix. A prompt response would be highly appreciated.
Thanks,