Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

clnt_create() program

Posted on 2000-03-17
3
Medium Priority
?
294 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 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

688 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