Shows how to setup a simple server that accepts client connections and sends a "hello" string to them. See the complete example description at Ecore_Con - Creating a server
#include <stdio.h>
#include <Ecore.h>
#include <Ecore_Con.h>
struct _Client
{
int sdata;
};
{
char welcome[] = "hello! - sent from the server";
struct _Client *client = malloc(sizeof(*client));
client->sdata = 0;
printf("Client with ip %s, port %d, connected = %d!\n",
printf("Clients connected to this server:\n");
}
{
struct _Client *client;
if (client)
{
printf("Total data received from this client: %d\n", client->sdata);
free(client);
}
printf("Client was connected for %0.3f seconds.\n",
}
{
char fmt[128];
snprintf(fmt, sizeof(fmt),
"Received %i bytes from client %s port %d:\n"
">>>>>\n"
"%%.%is\n"
">>>>>\n",
client->sdata += ev->
size;
}
int
main(void)
{
exit(1);
printf("Clients connected to this server when exiting: %d\n",
{
}
printf("Server was up for %0.3f seconds\n",
return 0;
}