libevent + チャットサーバ

libevent でチャットサーバのサンプルを書いたメモ。

チャット送受信のプロトコルを決めるなどして、少しだけまじめ。

libevent-chat-sample-0.1.tar.gz

インストール

事前に libevent が必要。インストールはこちら参照

  
$ tar zxvf libevent-chat-sample-0.1.tar.gz  
$ cd libevent-chat-sample-0.1  
$ ./configure --prefix=/path/to/install --with-libevent=/path/to/libevent  
$ make  
$ make install  

使用方法: サーバ

  
$ cd /path/to/install/bin  
$ ./libserver  

使用方法: クライアント

  
$ cd /path/to/install/bin  
$ ./libclient