if I've understood, I should do this, right?
while(1){
if((child = fork()) == 0){ /* child process */
close(s); /* close s because this socket was copied with the fork...
Type: Posts; User: Wisefool
if I've understood, I should do this, right?
while(1){
if((child = fork()) == 0){ /* child process */
close(s); /* close s because this socket was copied with the fork...
do I have to put a particular condition in the loop or is "while(1)" just enough?
and I just don't understand why I have to close the listening socket "s" before the accepted socket "ns". It...
I don't understand several things
1)what is the loop for? and how do you get out of this loop when you write while(1)?
2)
Shouldn't the child close the socket after it processes the request?...
I don't know where I have to put my close():
my code is like this:
#define SOCKET_ERROR -1
#define STRGLEN 100 /* message string length */
const int APORT = 1234; /* port number...
all right, it works
thx
I have 2 makefile
one for my client:
Client: Client.o # generate executable from objects
gcc Client.o -o Client
Client.o: Client.c
gcc -c Client.c
if I have a function like this:
void function(int* parameter){
int * variable;
variable = parameter;
}
do I have to make a malloc for variable?
well I know where the problem is
I just don't know what the problem is and how to solve it
it's just the last line of my server's code:
close(s);
If I put a printf before it, my screens will...
I can't close the socket of my server! It does everything as it should but this
I have this code for my client (which works just fine):
#include <sys/types.h> /* required include files */...
I can't close the socket of my server! It does everything as it should but this
I have this code for my client:
#include <sys/types.h> /* required include files */
#include...
how do you do to save the calendar time in a file?
one of the parameters in fprintf is the format of the variable I want to put in a file but what do I put?
time_t t;
FILE* p;
fprintf(p,...
ok here's what I've done so far
this is not my real source code, just a program specifically designed to test exchanges between a client and a server
server:
main(){
char string[STRGLEN],...
>>total += read;
does it mean total=total+read?
I can send/receive strings both ways between my client and my server
but now, I want to send the content of one (text) file from my client to my...
do recv and send automatically put a '\0'at the end of the string it sends?
and I always use the same string as a parameter, should I clear the string before I do the recv or send?
all right, the send/receive works just fine, thanks to you
now I'm trying to send the list of the users from the server to the client. I've set up a function which sends (or rather should send) to...
i've begun again from the very beginning
and it still doesn't work
I submit you my source code so you can tell me what's wrong
here's the code for the client:
// Main Function
main(int...
hi there
I'm trying to set up a client server system on unix.
i've got some troubles with my "write" and "read"
I want to send the data from the client like this
printf("Enter user's...