Solved

clnt_create() program

Posted on 2000-03-17
3
271 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 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 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

13 Experts available now in Live!

Get 1:1 Help Now