This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

about read(...) of TCP/IP


Have a look at the sizeof manual page. It returns the size (in bytes) of
a type
(ex. sizeof (char) returns 1). What you should give "read" is the number
of
bytes you expect the other end of the socket to send. If it sends less
bytes,
my guess is that you will wait forever.

Fano

>Subject: about read(...) of TCP/IP
>Date:  Wed, 28 Mar 2001 09:42:46 +0800
>From:  "ylyuan" <ylyuan@davform.com>
>To: "ecos-discuss" <ecos-discuss@sourceware.cygnus.com>
>
>Hi,part of my program is:
>    if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
>           printf("error to creat a socket\n");
>             exit(1);
>    }
>   if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
>              printf("error to connect\n");
>             exit(1);
>    }
>    read(s,buf,sizeof(buf));

Because the destination connected is a pop3 server,the function of read
should gain some information ,but it won't
return.From the buffer of hardware,I can see the information that I
want.Because the test of ppp_ping.c runs right,so I doubt
the question exists in TCP.
    Thanks a lot!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]