Solved

clnt_create() program

Posted on 2000-03-17
3
283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
ufolk123 earned 200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

734 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