Board index » cppbuilder » parse error with ansi c...

parse error with ansi c...


2003-10-29 03:11:07 AM
cppbuilder71
Hi
I have to code a timeclient, which connects to a time server, get the time
and displays in differnt ways.
In my function, where I get the time the compiler shows me a "parse error at
end of input" in a line which is behind the end of the function.
What did I wrong?
Thanks for the help.
Christoph
my includes:
/*All include files needed*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#ifdef _WIN32
#include <winsock.h>
#else
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <netinet/in.h>
#endif
/* allowed includes, made by Telematics Group*/
#include "general.h"
#include "logging.h"
#include "netutils.h"
/*private constants*/
#define TIME_DEFAULT_PORT 37
#define TIME_SERVICE "time"
#define BUFFER_SIZE 1024 /* max size of messages */
The function:
int communication (int sock)
{
char buf[BUFFER_SIZE]; /* buffer for reading from socket
*/
int msgLength; /* length of a message */
unsigned long recv_secs;
char finished = true;
dtrace ("entering communication()");
/* receive up to BUFFER_SIZE bytes from the server, since we
* communicate with the echo server the server should reply as
* many bytes (nBytes) as the client has send before
*/
if (recv_secs == 0)
{
derror("server has closed the connection");
}/*IF*/
else
{
derror("receiving buffer failed");
return (false);
}/*ELSE*/
printf("%ld", recv_secs);
/* check if an error occured */
if (! finished)
{
dtrace ("leaving handleCommunication() with error");
return (false);
} /*if*/
return (0);
}/* END OF FUNCTION COMMNUICATION*/
 
 

Re:parse error with ansi c...

I found my mistake... forget several } in the main function...
Christoph