Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

clnt_create() program

Posted on 2000-03-17
3
Medium Priority
?
299 Views
Last Modified: 2013-12-26
I need to create a client server program using clnt_cretae(). The client sends an integer to the server.The server takes this integer doubles it and sends the result back to the client.
Any suggestions greately appreciated.
0
Comment
Question by:delltrotter
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
ufolk123 earned 600 total points
ID: 2630626
You can not send the integer as such as the network byte order might be different will be different for two machines if they are running two different OS.You may have to use the

u_long htonl ( u_long hostlong ) function to covert the int to network byte order .
Now treat this long or int ( assuming int=4 bytes) to socket as char array.

On the target end use the
u_long ntohl ( u_long netlong ) on this char array to get the long value corresponding to target's machine order.

Do the calculation and send it back using htonl().
This way your program can talk between any type of OS.

If size of integer is 2 bytes see help of htons/ntohs macros.

Hope this helps ,if you any more doubts get back.

 

 
0
 

Author Comment

by:delltrotter
ID: 2631600
Any chance of example source code for this program as i am new to network programming.
0
 
LVL 3

Expert Comment

by:ufolk123
ID: 2634611
Please check out this page to start network programming.It is one of the best for beginners.

http://www.ecst.csuchico.edu/~beej/guide/net/


If you have any futher info required just write back.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses
Course of the Month9 days, 16 hours left to enroll

927 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