Easy Socket library

Version: Easy Socket 0.1
License: LGPL2 (see LICENSE)
© 1999-2000, Erich Roncarolo

  Bugs, contributes, mailing list and other informations at:
SourceForge Easy Socket Library Group

Project administrator has changed: now mail to Karl T. Cooper for any question.
 
 
 

Readme

Installation

Download

License

This library supplies some functions to bind and connect socket, and to read and write variables of all simple types and strings. It's written in C, but there is also an interface for PHP3.

In the library there are two function to bind and connect socket

int easy_tcp_bind(char *host, int port, int backlog);
int easy_tcp_connect(char *host, int port);
that return a socket handler that can be used usually.

There are also two functions to read and write each data type:

<type> read_<type>(int sock);
int write_<type>(int sock, <type> <data>);
These functions works very well sending each datum as is through the socket.

If reader and writer use, for example, integer of 16 bits (reader) and integer of 32 bits (writer) you should use another function:

int write_<type>_c(int sock, <type> <data>);
that convert data in a string of fixed size before send it. Then you can read data with:
<type> read_<type>_c(int sock);
that return a data of the correct type after reading the string. See easy_sock.h for functions details.

Obviously, you can always use standard read() and write() functions:

ssize_t read(int sock, void *buf, size_t count);
ssize_t write(int sock, const void *buf, size_t count);
 

Have a lot of fun!  
 


Powered by GNU

Easy Sockey library

© Copyright 1999-2000 - Erich Roncarolo