Hey guys,
I''ve got a problem I just can''t figure out. For a project, I need to write a client/server file transfer program where the client connects to a server to recieve files from it. My problem is sending the files. I am sending the file from the server through a call like this:
fstream f;
f.open (buffer, ios::in|ios::binary);
while (!f.eof ())
{
char temp[100];
f.read (temp, 100);
writen (isock, temp, 100); // this is a wrapper for write
}
f.close ();
As far as I can tell, the server is sending everthing just fine. The client doesn''t recieve anything though. Here is how I''m receiving the data:
fstream f;
f.open (buffer, ios::out|ios::binary);
int i = 1;
while (i == 1)
{
char temp[100];
int iread = readline (isock, temp, 100);
if ((iread == 0) || (iread == -1))
i = 0;
f.write (temp, 100);
}
f.close ();
The readline function is a wrapper that was provided. I added a select routine to determine if anything recieved on the socket should be reported. When this routine hits the read function, it blocks the client process. Does anyone know how to get this data recieved on the client?
Any help is grately appreciated!
-brad