GNet Network Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# Other tips and tricks

GNet was designed so that most of the implementation is hidden from the programmer. You should not have to include any network header files other than `gnet/gnet.h`.

GLib includes the functions `g_ntohs`, `g_htons`, `g_ntohl`, and `g_htonl`. Use these instead of the versions in `netinet/in.h`.

"Non-blocking" functions return immediately. Asynchronous functions are non-blocking and call a callback when completed. IO operations on socket IOChannels (e.g., read, write) are not non-blocking. Use GLib's asynchronous g_io_add_watch on a GIOChannel to set a callback to be called when the GIOChannel can be read (or written to, or there's an error). See the echoclient and echoserver for examples.

<<< Previous Page | Home | Up | Next Page >>>
GNet for developers | GNet Examples