* David M. Lloyd: > Doing this: UnixSocketChannel.open(String) or similar seems more > correct to me.
You need to do this twice, for SOCK_STREAM and SOCK_DGRAM. > If you go the route of using SocketChannel.open(SocketAddress), for > example, now you've got instanceof checks for each socket type. Does > this not seem like a so-called "code smell" to you? I've written an OO-ish socket abstraction, and I used struct sockaddr_storage as the glue between socket addresses and sockets (technically, I didn't even have to make the socket address class abstract, but I think I still did). There are some safety issues with this approach, though, and maybe OpenJDK needs to support systems without struct sockaddr_storage. Doing away wit socket addresses certainly has some charm, but you really need them for server sockets, for connectionless sockets, and for logging purposes.