From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,5acd9900de25ee62,start X-Google-Attributes: gid111c93,public X-Google-ArrivalTime: 2001-04-16 05:35:42 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!newsfeed.berkeley.edu!ucberkeley!ctu-gate!news.nctu.edu.tw!netnews.hinet.net!news.giga.net.tw!not-for-mail From: "ja" Newsgroups: comp.os.linux.alpha Subject: Who can help me? Date: Mon, 16 Apr 2001 20:31:30 +0800 Organization: Giga News Service Message-ID: <9beonk$16dd$1@news1.giga.net.tw> NNTP-Posting-Host: u88-31.u203-203.giga.net.tw X-Trace: news1.giga.net.tw 987424308 39341 203.203.88.31 (16 Apr 2001 12:31:48 GMT) X-Complaints-To: abuse@giga.net.tw NNTP-Posting-Date: 16 Apr 2001 12:31:48 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: supernews.google.com comp.os.linux.alpha:2712 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