Re: passing integers between client and server



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 ***
.



Relevant Pages

  • Re: VMware ESXi
    ... Virtual Server because my bios does not support virtualization. ... the vSpere client on my XP workstation. ... Now I want to create another VM on the same host this ... egg scenario if you have VMWare running with a DHCP assigned ...
    (microsoft.public.windows.server.sbs)
  • Re: What doesnt lend itself to OO?
    ... >> proxy and instructs the server to constuct the real object. ... rather than client code. ... If 'clock' is instantiated in the server, ... > for the server interface at the OOA level. ...
    (comp.object)
  • This is going straight to the pool room
    ... or not the client has privilege to do what they're trying to do, ... The server environment is this: ... 3GL User action Routines that Tier3 will execute on your behalf during the ... Routine Name: USER_INIT ...
    (comp.os.vms)
  • Re: VMware ESXi
    ... the vSpere client on my XP workstation. ... Now I want to create another VM on the same host this ... the VM server through the client and then click the DVD/CD Connect ... egg scenario if you have VMWare running with a DHCP assigned ...
    (microsoft.public.windows.server.sbs)
  • Re: VMware ESXi
    ... Now I want to create another VM on the same host this time ... Using the vSphere client on my desktop I can go ... the VM server through the client and then click the DVD/CD Connect ... egg scenario if you have VMWare running with a DHCP assigned ...
    (microsoft.public.windows.server.sbs)