Solved

receiving -server

Posted on 2011-03-23
11
351 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

790 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