Link to home
Start Free TrialLog in
Avatar of BeginToLearn
BeginToLearn

asked on

receiving -server

hi all,
 My client.c was verified and good. So I am working on my server.c. Please help me to point out my error in server.c which is coded base on the logic of client.c. I am reviewing it too. tks a lot.
client.c
server.c
Avatar of Infinity08
Infinity08
Flag of Belgium image

>> Please help me to point out my error

What error would that be ?

Do you get an error message ? If so, can you copy-paste it here literally ?
Does the code misbehave ? If so can you explain how it misbehaves ? (ie. what do you expect to happen, but what is happening instead)
Avatar of BeginToLearn
BeginToLearn

ASKER

ubuntu@ubuntu:~/program$ ./server
 received wrong size_to_read: Transport endpoint is not connected
ubuntu@ubuntu:~/program$

I am drawing picture how clients work and reviewing with server to make sure server match with client.  
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oh i am rearrage my functions to make it similar to the flow of client.c now :) give me 1 hour to complete it first. tks :)
please take a look at client.c
>> please take a look at client.c

Why ?


The error you are having, is because you are passing the wrong socket to the receiveMessage function. If you fix that, it should work better. No need for re-arranging code ;)
I fixed that error already. I must use "newsockfd" instead of "sockfd". The reason i rearrage my code is to make it t coherent to client.c . So it will make more sense and less prone-error, easier to debug hihi
Ok. That's fine.

But if your problem has been fixed, there seems to be no reason to keep this question open any more ...
hold on a little bit
on Server.c from line 115 to 126, how can know it finishes reading all trunk of the file? do I check the return of receiveMessage() to determine it? tks.
server.c
Ok, but this is not related to your original problem :

>>  received wrong size_to_read: Transport endpoint is not connected

so it should really go in a new question.
one hint: the message 2 gives filesize.

i'll elaborate more in your next question.

Sara

(please don't give points for this hint. you got the answer to your q. already).