in reply to Re^3: socket read buffer full
in thread socket read buffer full

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?.

Replies are listed 'Best First'.
Re^5: socket read buffer full
by ikegami (Patriarch) on Jan 07, 2009 at 12:52 UTC
    This allows errors and eof to be handled.
Re^5: socket read buffer full
by zwon (Abbot) on Jan 07, 2009 at 12:29 UTC

    this is how the select(2) works. From man select:

    select() and pselect() allow a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become "ready" for some class of I/O operation (e.g., input possible). A file descriptor is considered ready if it is possible to perform the corresponding I/O operation (e.g., read(2)) without blocking.

    So can_read returns true if you can read without blocking, and you can.