hi every1,
I use not-blocked tcp socket and i needed help with that..
Code:
write(sock, (struct auth*)&autorization, sizeof(struct auth));
r = read(socket_fd, recv, sizeof(recv));
for (i = 0; i < r; ++i){
if (.. /*checkout recv*/...){
write(sock, &data, sizeof(data));
}else{
printf("Authentication fault\n");
goto exit;
}
}
free(recv); // 1
r = read(socket_fd, recv, sizeof(recv));
// todo smth...
1) it's free needed or not? Because in the next if autorization was succesfull, that should do something.