Advertisement

09.20.2008 at 02:07PM PDT, ID: 23748649
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.4

TCP/IP programming socket port doubts

Asked by dtivmk in TCP/IP, Linux, Linux Networking

In a simple client server code for TCP/IP:
server side :
int sock2 = accept(sock1,&client,&clength);

client side :
int sock1 = socket(AF_INET,SOCK_STREAM,0);
connect(sock1,&serv,sizeof(serv));
------------
value of sock1 at client side is 3,
and value of sock2 at server side is 4.
but ain't both the sockets same?
then what do these values denote?
--------
Secondly, on the server side I can print
the port number of the client by cli.sin_port.
From where does that port number come?
Who assigns that port number to the client?
Client machine itself? When does that assignment happen?
-------------------
I compiled my code like gcc -g filename, but could
not step into the functions like accept,connect,bind etc.\
with gdb.
What do I need to do in order to step inside these function
calls?
-----------------
Do I really need to typecast variables of type "struct sockaddr_in"
to "struct sockaddr"? Since my code compiles simply with a warning
and runs fine, if I don't do this typecasting.
-----------------
If I include only <arpa/inet.h> and no other header files,like <sys/socket.h>,
then my code doesn't even give a warning, if I don't do this typecasting.
In fact, if I pass
"serv" in place of "&serv", even then there is no error/warning while
compiling. But the code doesn't work. Why?Start Free Trial
 
Loading Advertisement...
 
[+][-]09.20.2008 at 02:11PM PDT, ID: 22531644

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.20.2008 at 08:13PM PDT, ID: 22533063

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: TCP/IP, Linux, Linux Networking
Sign Up Now!
Solution Provided By: duncan_roe
Participating Experts: 1
Solution Grade: B
 
 
[+][-]09.20.2008 at 08:29PM PDT, ID: 22533117

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.21.2008 at 03:37AM PDT, ID: 22533941

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 14-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.25.2008 at 05:51AM PDT, ID: 22568461

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.25.2008 at 02:52PM PDT, ID: 22574276

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 14-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.27.2008 at 04:25AM PDT, ID: 22586291

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.27.2008 at 09:29AM PDT, ID: 22587685

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 14-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]09.28.2008 at 05:07AM PDT, ID: 22590653

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.28.2008 at 11:14AM PDT, ID: 22592041

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.28.2008 at 03:20PM PDT, ID: 22592786

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628