1
0
This commit is contained in:
adam 2019-11-09 23:46:08 +01:00
parent 8c7115ef7b
commit fb938341f1

View File

@ -73,12 +73,12 @@ int main(void) {
//Sprawdzenie Poprawności //Sprawdzenie Poprawności
//printf("Przed Select\n"); //printf("Przed Select\n");
if(select(socket_bind+1, &Socket, NULL, NULL, NULL) < 0) { if(select(socket_bind+1, &Socket, NULL, NULL, NULL) > 0) {
if (FD_ISSET(socket_bind, &Socket)) { if (FD_ISSET(socket_bind, &Socket)) {
temp_accept = accept(socket_bind, (struct sockaddr*) &client[i].accept_adr, &dl) temp_accept = accept(socket_bind, (struct sockaddr*) &client[i].accept_adr, &dl);
for(i=0;i<=4;i++){ for(i=0;i<=4;i++){
if (client[i].socket == temp_accept){ if (client[i].socket == temp_accept){
recv(client[i].socket, &msg, 1024, 0); recv(client[i].socket, msg, 1024, 0);
break; break;
} }
} }
@ -106,7 +106,7 @@ int main(void) {
} }
printf("Wiadomość:%s\n", msg); printf("Wiadomość:%s\n", msg);
//PRZETWARZANIE WIADOMOŚCI //PRZETWARZANIE WIADOMOŚCI
if(select(max_fd+1, NULL, &Clients, NULL, NULL) < 0) { if(select(max_fd+1, NULL, &Clients, NULL, NULL) > 0) {
for(i=0;i<=4;i++){ for(i=0;i<=4;i++){
if (FD_ISSET(client[i].socket, &Clients)) { if (FD_ISSET(client[i].socket, &Clients)) {