About the command handling of MSN protocol
mark at kingant.net
Tue Jun 23 03:04:03 EDT 2009
On Mon, Jun 22, 2009 at 6:17 AM, Peng Jing<pj.phantom at yahoo.com.cn> wrote:
> I plan to employ some multi-threading: one thread keeps listenning to the
> incoming commands from the server, put them in a cache, and the other thread
> scans the cache and pick out those complete commands and enqueue them. But
> this may involve some thread synchronization problems which are a little
> difficult and tedious to deal with.
> Does anyone have some good ideas?
One popular technique for network I/O is to watch the network socket
for incoming data, then call read() when you know there is something
to be read. The poll() and select() functions are the traditional
ways of doing this. libevent and libev are probably more convenient,
if you want to support multiple-platforms. Or if you're developing a
glib application you can use GIOChannels.
More information about the Support