Solved

clnt_create() program

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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

622 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