Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

receiving -server

Posted on 2011-03-23
11
Medium Priority
?
359 Views
Last Modified: 2012-06-21
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
0
Comment
Question by:BeginToLearn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
11 Comments
 
LVL 53

Expert Comment

by:Infinity08
ID: 35204754
>> 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)
0
 

Author Comment

by:BeginToLearn
ID: 35204767
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.  
0
 
LVL 53

Accepted Solution

by:
Infinity08 earned 2000 total points
ID: 35204808
>>       string totalfile = receiveMessage( sockfd);

The connection with the client is on the newsockfd socket.
The sockfd socket is used by the server for listening for incoming connections.

Make sure to use the right one ;)
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:BeginToLearn
ID: 35204814
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
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 35204818
>> 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 ;)
0
 

Author Comment

by:BeginToLearn
ID: 35204842
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
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 35204854
Ok. That's fine.

But if your problem has been fixed, there seems to be no reason to keep this question open any more ...
0
 

Author Comment

by:BeginToLearn
ID: 35204863
hold on a little bit
0
 

Author Comment

by:BeginToLearn
ID: 35204954
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
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 35205019
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.
0
 
LVL 35

Expert Comment

by:sarabande
ID: 35205500
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).
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question