One of the most common, and nicest, abstractions in Unix is "everything is a file". For example, check out /dev to see files for all your hard drives, the modem, the OS's random number service, etc. Basically, dealing with something that has a 'pseudo file' representation, whether it's a physical device or a service like MySQL, can then take on the familiar semantics of file I/O.
A socket can be bound to an IP port, so that it can be accessed via Internet, or to a file path, so that it can be accessed via filesystem calls. Once you have a file descriptor for the socket though, you just use read() and write() calls on it, no matter what it was bound to.
So, to answer your question - the only advantage to one method over another would be what you're most comfortable programming with.




LinkBack URL
About LinkBacks
ort but also by a socket path such as localhost:/tmp/mysql.sock which I noticed exists on my machine...
Reply With Quote
Bookmarks