htonl

Confusion in htons- little endian/ big endian

When I send a integer variable from one process to other through socket, and then printing the value at received end, the value is still the same without using ntohl/htonl, then where do I need to use these functions other than initializing socket structures. I understand litte/big endian. But why do we need to convert port and IP nos to...

c++ server htons to java ntohs client conversion

Hi I am creating a small TFTP client server app where server is developed using c++ and client using java. Here i am sending "block count" value using htons conversion. But i am not able to convert it back to its original value at client. for example if am sending block count ntohs(01) (2 bytes) from se...

building up char * for network stream communication

Hello, I need to create a char * which has the following layout: length of username in network byte order (htonl) username length of password in network byte order (htonl) password 7 null characters (\0) length of the char * in network byte order (htonl) Can someone provide some advise as to how to build up this char * concatenating t...

[C#] ntohs() and ntohl() equivalent?

Are there net to host conversion functions in C#? Googling and not finding much. :P ...

Is there any "standard" htonl-like function for 64 bits integers in C++ ?

Hi, I'm working on an implementation of the memcache protocol which, at some points, uses 64 bits integer values. These values must be stored in "network byte order". I wish there was some uint64_t htonll(uint64_t value) function to do the change, but unfortunately, if it exist, I couldn't find it. So I have 1 or 2 questions: Is the...