As I already said in my earlier post, I did the select and read already.
I predicted that the read side of the socket is full in B side, so I started to read the data from B's side also apart from writing, the problem got solved.
The shutdown method worked. Thanks for that solution.
One more question
Even after shutting down the read side of the B socket, the B's socket->can_read is saying that some data is available for reading(but doing a <Bsocket> returns undef), why it is like this?.