Re: passing integers between client and server
- From: Barry Margolin <barmar@xxxxxxxxxxxx>
- Date: Wed, 29 Mar 2006 02:32:57 -0500
In article <1143603045.887269.55200@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
"sai" <aravallisai@xxxxxxxxx> wrote:
Hi,
how can i send integers between client and server in tcp/ip socket
programming...
example: adding of 2 numbers.
Client takes inputs ( say x and y) and sends them to server ...
Server does the processing(z=x+y).. and sends the result to client.
i am able to pass string messages between client and server,but how can
i pass integers is my question.
Use htonl() or htons() to convert the integer to standard network byte
order, send it, and then use ntohl() or ntohs() on the receiving end to
convert it back to host byte order.
--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.
- Follow-Ups:
- Re: passing integers between client and server
- From: Rick Ingham
- Re: passing integers between client and server
- References:
- Prev by Date: Re: passing integers between client and server
- Next by Date: Re: sendto () and recvfrom() with the same IP address
- Previous by thread: Re: passing integers between client and server
- Next by thread: Re: passing integers between client and server
- Index(es):
Relevant Pages
|