Well.. what do I have to look in the synaptic? How will that help me on my project?
Well.. what do I have to look in the synaptic? How will that help me on my project?
What do I have to read here?
Thats what my program is doing, but that's not my problem, my problem is that it's not asking me for a filename, it just disconnects and exitsIf no messages are available at the socket, the receive calls wait for
a message to arrive, unless the socket is non-blocking (see fcntl(2)),
in which case the value -1 is returned and the external variable errno
set to EAGAIN. The receive calls normally return any data available,
up to the requested amount, rather than waiting for receipt of the full
amount requested.
You don't want & there.Code:if(fwrite(buff, 1048576, 1, file) == -1) { printf("Error writing file %s in part: %i", filepath, &i); //prototipo } else { printf("Part %i Compleated", &i); }
fwrite returns size_t value
hard to beleive it will ever return -1
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
Thanks, errors corrected, but why it is not asking me for the filename? it's like that function isn't being executed
You send password as a non-null terminated string, and the server doesn't know where the end is, and therefore, the strcmp might always fail.
Additionally, the recv call might receive more or less than the length of the password.
I thought that the password was being sent as a string, do I have to add an \0 to the end of the string to strcmp them?
No, to the string you send. strlen doesn't include the nul character. And you also have to only receive the length of the string plus the nul character so that you don't gobble up any data that you need later in your program.
I see.. and what about changing the strlen for size?
Huh?
You'r talking about this right? send(sock, password, strlen(password), 0); and you'r telling me that the \0 char is not beeing send, so I have to change it to send(sock, password, sizeof(password), 0); ? or I could try adding the \0 on recieving..
Mmm.. it's still not working..
******@******-desktop:~/Escritorio/codigo c$ ./fileclient
Socket Creado
test reusando adress
Conectando // Connecting
// Not connected
******@******-desktop:~/Escritorio/codigo c$ ./fileserver
Socket Creado
Port 3000 bindeado
Socket Listeneando
Select starteado
Nueva conexion.. testeando pass //New connection, testing passwd (?)
Password correcta //correct passwd
Select starteado // select started
Conexion perdida // connection lost
Last edited by lautarox; 09-11-2008 at 12:30 PM.
Did you start the server before the client?
Yes I did, if not it wouldn't be connecting to the server, and the server is responding, the sendfile function is not working, I don't really know why