This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
about read(...) of TCP/IP
- To: ylyuan at davform dot com
- Subject: [ECOS] about read(...) of TCP/IP
- From: Fano Ramparany <Fano dot Ramparany at rd dot francetelecom dot fr>
- Date: Wed, 28 Mar 2001 18:06:23 +0200
- CC: eCos Disuss <ecos-discuss at sourceware dot cygnus dot com>
- Organization: France Telecom
- Reply-To: Fano dot Ramparany at rd dot francetelecom dot fr
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!