Skip to content

Commit

Permalink
Assignment 8: Bug rmmod: ERROR: Module is in use
Browse files Browse the repository at this point in the history
  • Loading branch information
mukesh2006 committed Jan 15, 2025
1 parent 3a33fd8 commit 8bfb95b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions server/aesdsocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,6 @@ int main(int argc, char* argv[])
daemon(0, 0);
}

//open the file to write the input from different clients
#ifdef USE_AESD_CHAR_DEVICE
received_data_file_fd = open(RECEIVE_DATA_FILE, O_CREAT | O_APPEND | O_RDWR , 0644);
#else
received_data_file_fd = fopen(RECEIVE_DATA_FILE, "w+");
#endif


// Timer init
setup_print_time_thread(10);
Expand Down Expand Up @@ -249,7 +242,14 @@ void* connection_handler_thread_fxn(void* thread_parameter)
int number_of_bytes_sent = 0;
int number_of_bytes_read = 0;
while((number_of_bytes_read = recv(thread_func_args->client_fd, read_buffer, RECEIVE_PACKET_SIZE, 0)) > 0)
{
{
//open the file to write the input from different clients
#ifdef USE_AESD_CHAR_DEVICE
received_data_file_fd = open(RECEIVE_DATA_FILE, O_CREAT | O_APPEND | O_RDWR , 0644);
#else
received_data_file_fd = fopen(RECEIVE_DATA_FILE, "w+");
#endif

write(received_data_file_fd, read_buffer, number_of_bytes_read);
// Your implementation should use a newline to separate data packets received.
// In other words a packet is considered complete when a newline character is found in the input receive stream,
Expand Down

0 comments on commit 8bfb95b

Please sign in to comment.