Skip to content

Commit

Permalink
correct print buffer not correct
Browse files Browse the repository at this point in the history
  • Loading branch information
jerash committed Dec 23, 2013
1 parent c93e642 commit 8425151
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions jpmidi/src/tcpserver.c
Expand Up @@ -163,7 +163,7 @@ static void app(int tcp_port)
continue;
}

printf("New client connection on socket %d \n",csock);
printf("New client connection on socket %d \n",csock);

/* what is the new maximum fd ? */
max = csock > max ? csock : max;
Expand All @@ -190,16 +190,17 @@ static void app(int tcp_port)
/* client disconnected */
closesocket(clients[i].sock);
remove_client(clients, i, &actual);
strncpy(buffer, client.name, BUF_SIZE - 1);
strncat(buffer, " disconnected !", BUF_SIZE - strlen(buffer) - 1);
// strncpy(buffer, client.name, BUF_SIZE - 1);
strncat(buffer, "\n client disconnected !\n", BUF_SIZE - strlen(buffer) - 1);
printf("%s",buffer);
strcpy(buffer,"");
}
else
{
/* DOSTUFF*/
printf("received buffer: %s \n",buffer);
if(do_command((char*)&buffer))
running=0;
printf("received buffer: %s \n",buffer);
if(do_command((char*)&buffer))
running=0;
}
break;
}
Expand Down

0 comments on commit 8425151

Please sign in to comment.