From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,5acd9900de25ee62 X-Google-Attributes: gid111c93,public X-Google-ArrivalTime: 2001-04-18 22:10:12 PST Path: supernews.google.com!newsfeed.google.com!newsfeed.stanford.edu!newsfeed.mesh.ad.jp!uunet!osa.uu.net!sac.uu.net!news.compaq.com!news.cpqcorp.net!not-for-mail Message-ID: <3ADE75F0.1F75B49@digital.com> From: "Aneesh Kumar K.V" X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.4.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.linux.alpha Subject: Re: Who can help me? References: <9beonk$16dd$1@news1.giga.net.tw> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 19 Apr 2001 10:51:52 +0530 NNTP-Posting-Host: 16.168.64.37 X-Complaints-To: abuse@Compaq.com X-Trace: news.cpqcorp.net 987657009 16.168.64.37 (Wed, 18 Apr 2001 22:10:09 PDT) NNTP-Posting-Date: Wed, 18 Apr 2001 22:10:09 PDT Organization: Compaq Computer Corporation Xref: supernews.google.com comp.os.linux.alpha:2754 Hi , Try including header in the order given in the manual . time , types , unistd.h . and for try if (connect (Socket, ( const srtruct sockaddr *)ServerAddr, sizeof (struct sockaddr_in)) == ERROR) { -aneesh ja wrote: > I face a problem about compile. > > %cc -o AppTest AppTest.c > AppTest.c: In function 'Attempt Connection': > AppTest.c:253: in compatible type for argument 2 of 'connect' > AppTest.c: In function 'GetReturnStatus': > AppTest.c:storage size of 'readFds' isn't known. > > Do you know what's wrong? > Below is my program. > > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > > /* include files needed for "herror ()" call */ > #include > #include > #include > #include > > int AttemptConnection (ConnectionStatus) > int *ConnectionStatus; > { > int Socket, I; > struct sockaddr_in ServerAddr; > > Socket = stream_socket_info.Socket; > ServerAddr = stream_socket_info.Addr; > > //AppTest.c:253: in compatible type for argument 2 of 'connect' > // compile tell me ServerAddr have something wrong . why??? > // How to modify ? > if (connect (Socket, ServerAddr, sizeof (struct sockaddr_in)) == ERROR) > { > if (errno == ECONNREFUSED) > { > perror ("INFO - Attempting connection to server "); > close (Socket); > if (CreateStreamSocket(I) == ERROR) return(ERROR); > } > else > { > perror ("FATAL ERROR - Attempting connection to server "); > return (ERROR); > } > } > else > { > > printf ("Successful connection to %s\n", stream_socket_info.HostName); > > *ConnectionStatus = CONNECTED; > return (NO_ERROR); > } > *ConnectionStatus = NOT_CONNECTED; > return (NO_ERROR); > } > > int GetReturnStatus () > { > int BytesRead; > int selectCount; > //AppTest.c:storage size of 'readFds' isn't known. > //How to modify? > struct fd_set readFds; > struct timeval timeLimit; > > timeLimit.tv_sec = TIME_OUT; > timeLimit.tv_usec = 0; > > FD_ZERO (&readFds); > > FD_SET (stream_socket_info.Socket, &readFds); > > printf("WAITING FOR RESPONSE.....\n"); > selectCount = select (FD_SETSIZE, &readFds, NULL,NULL, &timeLimit); > > if (selectCount == ERROR) > { > printf ("FATAL ERROR - select failed in GetReturnStatus.\n"); > return (ERROR); > } > > if (selectCount == 0) > { > printf ("FATAL ERROR - Time out occured in GetReturnStatus.\n"); > return (ERROR); > } > > if ((BytesRead = > read (stream_socket_info.Socket, &control_message, BUFLEN)) == > ERROR) > { > perror ("FATAL ERROR - GetReturnStatus (read).\n"); > return (ERROR); > } > > if (BytesRead < BUFLEN) > { > printf ("FATAL ERROR - Read from socket incomplete!!! \n"); > return (ERROR); > } > > printf ("%s for %s \n", control_message.Buffer1, WscStationId); > > } > > Thank you! > > rodercat@giga.net.tw