so i finally got the server.c program to run in linux environment i was elated to start the client.c program it turned out that there would be another problem.

below codes are the codes of client program i compiled it and it produced an exe but there is a warning that say's there is no new line at the end of file. what should i do?

WARNING: NO NEW LINE AT THE END OF FILE

another question is.. how will it affect my client.exe? i don't really know what to expect once you run the programs. please explain?

// this part of the code is in the last part this is where the problem lies..

	while(0<(status=read(clientSocket,buffer,sizeof(buffer)-1)))
		printf("%f: %s", status,buffer);
	if(-1==status)perror("read()");
	close(clientSocket);
	return 0;
}

Recommended Answers

All 5 Replies

>WARNING: NO NEW LINE AT THE END OF FILE
>What should I do?

Move your cursor to the end of the latest line of your file and press ENTER.
Then try recompiling your source, the warning should be away.

commented: Your wisdom is endless, all bow to the mighty tux ;) +20
commented: Free food for the gimme question :) +36


another question is.. how will it affect my client.exe? i don't really know what to expect once you run the programs. please explain?

It won't affect it at all -- just put the blank line at the end of the file like the warning message asked you to do.

I'm surprised there are still compilers that produce that warning message. I haven't seen it in more than 15 years.

I'm surprised there are still compilers that produce that warning message. I haven't seen it in more than 15 years.

I actually see this warning quit often. I compile a lot of stuff for microcontrollers and all those compilers complain about it.
Most texteditors put a '\n' after each line automatically, so perhaps even 'modern' compilers will complain about it when you give them a file created with something oldschool like 'edit' ?
As far as I know, it's still part of the C++ standard that you can't end a file without a new-line (or a backslash with a new-line) because the behavior will be undefined.

commented: That clarifies the whole thing :) +11
commented: Good post +36

thanks guys..
now another question is how will i test the hello world server/client program.
can i use only 1 pc someone said i should use 2? since its a networking program is that correct?

thanks guys..
now another question is how will i test the hello world server/client program.
can i use only 1 pc someone said i should use 2? since its a networking program is that correct?

You could use what's called: 'a virtual pc'
In that case it's like you have two pc's (but in fact you only have one real pc, and on the real pc you run a kind of emulator software, this is software which emulates the hardware of a pc. In that emulated computer, you can install another operating system, connect it to a network...), but you'll have to make sure that your current pc has enough RAM to run the Virtual Machine on of course.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.