Solved

receiving -server

Posted on 2011-03-23
11
348 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
 

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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 32

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now