On Fri, 23 Jan 2004, Shahed Moolji wrote:
Sorry for this stupid question, but I am wondering what extra functionality can these libraries provide that is not provided by that standard C library ?
It just provides an added layer of abstraction so the programmer can worry about doing his job rather than debugging socket calls.
Is it with an aim to simplify protocol usage for DNS, SMTP etc etc ?
yes, something like that.
Also, I did not understand the part in the original post that spoke about not using threads. Coming from a Java environment, I am used to doing blocked I/O on sockets in threads (not using the NIO packages), and using an event notification mechanism when data is received etc. Is that not an easier approach than using poll() or select() ??
Except this wouldn't work in a single threaded environment. Having multiple threads would also increase the weight of the process. Using select would not. Finally, threads throw up concurrency issues that add to the complexity of the program and allow subtle bugs to creep in. The programmer should really be doing his job rather than worrying about mutexs.
Also, there is no standard threading library in C (AFAIK). pthreads isn't really standard, although you'd find it wherever you find gcc.
I may be wrong, so correct me if you think so.
Philip