Bugfixes, List stopt nicht
This commit is contained in:
parent
3d54d01d2e
commit
a1cc0dfce7
10
myclient.c
10
myclient.c
@ -99,15 +99,21 @@ int main(int argc, char **argv)
|
||||
mode = 0;
|
||||
printf("\x1B[34m");
|
||||
printf("->List");
|
||||
while (strcmp(buffer, "LISTREADSTOPNOW\n") != 0)
|
||||
do
|
||||
{
|
||||
size = recv(create_socket, buffer, BUF - 1, 0);
|
||||
if (size > 0)
|
||||
{
|
||||
buffer[size] = '\0';
|
||||
printf("\x1B[37m %s", buffer);
|
||||
//if (strcmp(buffer, "LISTREADSTOPNOW\n") == 0)
|
||||
//{
|
||||
printf("\x1B[37m %s", buffer);
|
||||
printf("CHECK LASTLINE: %d", strncmp(buffer, "LISTREADSTOPNOW\n", strlen("LISTREADSTOPNOW\n")));
|
||||
printf("CHECK LASTLINE other: %d", strcmp(buffer, "LISTREADSTOPNOW\n"));
|
||||
//}
|
||||
}
|
||||
}
|
||||
while (strncmp(buffer, "LISTREADSTOPNOW\n", strlen("LISTREADSTOPNOW\n")) != 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
14
myserver.c
14
myserver.c
@ -242,20 +242,19 @@ struct rec readFile(char filename[1024])
|
||||
//return &nullstruct;
|
||||
}
|
||||
printf("A");
|
||||
struct rec my_record;
|
||||
struct rec *my_record;
|
||||
//struct rec *my_record_p = malloc(sizeof(struct rec));
|
||||
printf("B");
|
||||
fread(&my_record, sizeof(struct rec), 1, filePointer);
|
||||
fread(my_record, sizeof(struct rec), 1, filePointer);
|
||||
printf("C");
|
||||
|
||||
printf("\nBETREFF in readFile(): %s", my_record.betreff);
|
||||
printf("\nBETREFF in readFile(): %s", my_record->betreff);
|
||||
printf("D");
|
||||
fclose(filePointer);
|
||||
//my_record_p->betreff = my_record.betreff;
|
||||
//my_record_p->sender = my_record.sender;
|
||||
//my_record_p->receiver = my_record.receiver;
|
||||
//my_record_p->msg = my_record.msg;
|
||||
return my_record;
|
||||
return *my_record;
|
||||
}
|
||||
|
||||
int writeToFile(char sender[1024], char betreff[1024], char receiver[1024], char message[1024])
|
||||
@ -517,7 +516,7 @@ int main(int argc, char **argv)
|
||||
struct rec my_record_p = readFile(filename);
|
||||
printf("2.5.%d\n", i);
|
||||
//Send to client
|
||||
printf("\n\nEINGANG -- Nachricht: %d Betreff: %s\n\n", i, my_record_p.betreff);
|
||||
printf("\n\nEINGANG -- Nachricht: %d Betreff: %s", i, my_record_p.betreff);
|
||||
sprintf(posteingangMsg, "\x1B[34mBetreff: %s\n", my_record_p.betreff);
|
||||
sendresult = send(new_socket, posteingangMsg, strlen(posteingangMsg), 0);
|
||||
printf("Send result: %d\n", sendresult);
|
||||
@ -528,7 +527,6 @@ int main(int argc, char **argv)
|
||||
printf("3\n");
|
||||
|
||||
//postausgang
|
||||
|
||||
|
||||
filename[1024];
|
||||
strcpy(filename, "postausgang/");
|
||||
@ -539,7 +537,7 @@ int main(int argc, char **argv)
|
||||
printf("msgnumberstruct lenght: %d\n", msgNumbersStructAusgang.lenght);
|
||||
//Send to client
|
||||
char postausgangMsg[1024];
|
||||
sprintf(postausgangMsg, "\x1B[32mPOSTAUSGANG Nachrichten: %d\n\n", msgNumbersStructAusgang.lenght);
|
||||
sprintf(postausgangMsg, "\x1B[32mPOSTAUSGANG Nachrichten: %d\n", msgNumbersStructAusgang.lenght);
|
||||
sendresult = send(new_socket, postausgangMsg, strlen(postausgangMsg), 0);
|
||||
printf("Send result: %d", sendresult);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user