Solved

receiving -server

Posted on 2011-03-23
11
350 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
  • 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 500 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

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 33

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
logging Access violation 6 19
White board coding practice 3 88
designing in object programming 12 79
How to read a c++ line with strings and variable numbers of elements 6 28
When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

803 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