Bugfixes, List stopt nicht
This commit is contained in:
		
							
								
								
									
										10
									
								
								myclient.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								myclient.c
									
									
									
									
									
								
							@@ -99,15 +99,21 @@ int main(int argc, char **argv)
 | 
				
			|||||||
            mode = 0;
 | 
					            mode = 0;
 | 
				
			||||||
            printf("\x1B[34m");
 | 
					            printf("\x1B[34m");
 | 
				
			||||||
            printf("->List");
 | 
					            printf("->List");
 | 
				
			||||||
            while (strcmp(buffer, "LISTREADSTOPNOW\n") != 0)
 | 
					            do
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
               size = recv(create_socket, buffer, BUF - 1, 0);
 | 
					               size = recv(create_socket, buffer, BUF - 1, 0);
 | 
				
			||||||
               if (size > 0)
 | 
					               if (size > 0)
 | 
				
			||||||
               {
 | 
					               {
 | 
				
			||||||
                  buffer[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;
 | 
					            break;
 | 
				
			||||||
         }
 | 
					         }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										14
									
								
								myserver.c
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								myserver.c
									
									
									
									
									
								
							@@ -242,20 +242,19 @@ struct rec readFile(char filename[1024])
 | 
				
			|||||||
      //return &nullstruct;
 | 
					      //return &nullstruct;
 | 
				
			||||||
   }
 | 
					   }
 | 
				
			||||||
   printf("A");
 | 
					   printf("A");
 | 
				
			||||||
   struct rec my_record;
 | 
					   struct rec *my_record;
 | 
				
			||||||
   //struct rec *my_record_p = malloc(sizeof(struct rec));
 | 
					   //struct rec *my_record_p = malloc(sizeof(struct rec));
 | 
				
			||||||
   printf("B");
 | 
					   printf("B");
 | 
				
			||||||
   fread(&my_record, sizeof(struct rec), 1, filePointer);
 | 
					   fread(my_record, sizeof(struct rec), 1, filePointer);
 | 
				
			||||||
   printf("C");
 | 
					   printf("C");
 | 
				
			||||||
   
 | 
					   printf("\nBETREFF in readFile(): %s", my_record->betreff);
 | 
				
			||||||
   printf("\nBETREFF in readFile(): %s", my_record.betreff);
 | 
					 | 
				
			||||||
   printf("D");
 | 
					   printf("D");
 | 
				
			||||||
   fclose(filePointer);
 | 
					   fclose(filePointer);
 | 
				
			||||||
   //my_record_p->betreff = my_record.betreff;
 | 
					   //my_record_p->betreff = my_record.betreff;
 | 
				
			||||||
   //my_record_p->sender = my_record.sender;
 | 
					   //my_record_p->sender = my_record.sender;
 | 
				
			||||||
   //my_record_p->receiver = my_record.receiver;
 | 
					   //my_record_p->receiver = my_record.receiver;
 | 
				
			||||||
   //my_record_p->msg = my_record.msg;
 | 
					   //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])
 | 
					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);
 | 
					                     struct rec my_record_p = readFile(filename);
 | 
				
			||||||
                     printf("2.5.%d\n", i);
 | 
					                     printf("2.5.%d\n", i);
 | 
				
			||||||
                     //Send to client
 | 
					                     //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);
 | 
					                     sprintf(posteingangMsg, "\x1B[34mBetreff: %s\n", my_record_p.betreff);
 | 
				
			||||||
                     sendresult = send(new_socket, posteingangMsg, strlen(posteingangMsg), 0);
 | 
					                     sendresult = send(new_socket, posteingangMsg, strlen(posteingangMsg), 0);
 | 
				
			||||||
                     printf("Send result: %d\n", sendresult);
 | 
					                     printf("Send result: %d\n", sendresult);
 | 
				
			||||||
@@ -529,7 +528,6 @@ int main(int argc, char **argv)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                  //postausgang
 | 
					                  //postausgang
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
                  filename[1024];
 | 
					                  filename[1024];
 | 
				
			||||||
                  strcpy(filename, "postausgang/");
 | 
					                  strcpy(filename, "postausgang/");
 | 
				
			||||||
                  strcat(filename, username);
 | 
					                  strcat(filename, username);
 | 
				
			||||||
@@ -539,7 +537,7 @@ int main(int argc, char **argv)
 | 
				
			|||||||
                  printf("msgnumberstruct lenght: %d\n", msgNumbersStructAusgang.lenght);
 | 
					                  printf("msgnumberstruct lenght: %d\n", msgNumbersStructAusgang.lenght);
 | 
				
			||||||
                  //Send to client
 | 
					                  //Send to client
 | 
				
			||||||
                  char postausgangMsg[1024];
 | 
					                  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);
 | 
					                  sendresult = send(new_socket, postausgangMsg, strlen(postausgangMsg), 0);
 | 
				
			||||||
                  printf("Send result: %d", sendresult);
 | 
					                  printf("Send result: %d", sendresult);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user