avoid non-portable casts add explicit casts
but sockets instead, internally. Old, backward compatible interfaces maintained.