Have trouble reading the data from sockets. - TCP-IP

This is a discussion on Have trouble reading the data from sockets. - TCP-IP ; Hi, I am facing an issue when reading the data from socket. Write into fd tells that data has been written but when the server tries to read, it return 0 bytes. This is seen only when all the socket ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Have trouble reading the data from sockets.

  1. Have trouble reading the data from sockets.

    Hi,

    I am facing an issue when reading the data from socket. Write into
    fd tells that data has been written but when the server tries to read,
    it return 0 bytes. This is seen only when all the socket fd's are
    utilized. I dont see any issues with the memory buffers.

    Iam using the non blocking with linger turned on.
    Can anyone please help me to reslove this issue.

    Thanks,
    Seema.

  2. Re: Have trouble reading the data from sockets.

    In article
    <9a2dab43-18d0-4468-9b25-27fbdd74bba8@i76g2000hsf.googlegroups.com>,
    seema wrote:

    > Hi,
    >
    > I am facing an issue when reading the data from socket. Write into
    > fd tells that data has been written but when the server tries to read,
    > it return 0 bytes. This is seen only when all the socket fd's are
    > utilized. I dont see any issues with the memory buffers.
    >
    > Iam using the non blocking with linger turned on.
    > Can anyone please help me to reslove this issue.


    If read() returns 0 it means that it read EOF, i.e. the connection has
    been closed. But that shouldn't happen until it has read everything the
    client has written.

    There's probably a bug in your program. Based on the details you've
    provided, I think it's somewhere between line 1 and the last line.

    --
    Barry Margolin, barmar@alum.mit.edu
    Arlington, MA
    *** PLEASE don't copy me on replies, I'll read them in the group ***

+ Reply to Thread