Index: include/libroar/vio_dstr.h
===================================================================
--- include/libroar/vio_dstr.h	(revision 1330)
+++ include/libroar/vio_dstr.h	(revision 1333)
@@ -122,5 +122,20 @@
           int               type;
           char            * host;
-          struct sockaddr * sa;
+          union {
+                 struct sockaddr     sa;
+                 struct sockaddr_in  in;
+#ifdef ROAR_HAVE_UNIX
+                 struct sockaddr_un  un;
+#endif
+#ifdef ROAR_HAVE_LIBDNET
+                 struct sockaddr_dn  dn;
+#endif
+#ifdef ROAR_HAVE_IPV6
+                 struct sockaddr_in6 in6;
+#endif
+#ifdef ROAR_HAVE_IPX
+                 struct sockaddr_ipx ipx;
+#endif
+                } sa;
           socklen_t         len;
          } socket;
Index: include/libroar/vio_socket.h
===================================================================
--- include/libroar/vio_socket.h	(revision 1332)
+++ include/libroar/vio_socket.h	(revision 1333)
@@ -42,4 +42,6 @@
 int     roar_vio_open_def_socket          (struct roar_vio_calls * calls, struct roar_vio_defaults * def);
 
+int     roar_vio_socket_init_socket_def   (struct roar_vio_defaults * def, int domain, int type);
+
 int     roar_vio_socket_init_unix_def     (struct roar_vio_defaults * def, char * path);
 int     roar_vio_socket_init_decnet_def   (struct roar_vio_defaults * def, char * node, int object, char * objname);
Index: libroar/vio_dstr.c
===================================================================
--- libroar/vio_dstr.c	(revision 1330)
+++ libroar/vio_dstr.c	(revision 1333)
@@ -176,5 +176,6 @@
    break;
   case ROAR_VIO_DEF_TYPE_SOCKET:
-     return -1;
+     if ( roar_vio_open_def_socket(calls, def) == -1 )
+      return -1;
    break;
   case ROAR_VIO_DEF_TYPE_FH:
@@ -429,4 +430,26 @@
      next->def->d.fh = tmp[1];
     break;
+/*
+#define ROAR_VIO_DSTR_OBJT_SOCKET         (0x01|ROAR_VIO_DSTR_OBJGT_SOCKET)
+#define ROAR_VIO_DSTR_OBJT_UNIX           (0x02|ROAR_VIO_DSTR_OBJGT_SOCKET)
+#define ROAR_VIO_DSTR_OBJT_DECNET         (0x10|ROAR_VIO_DSTR_OBJGT_SOCKET)
+#define ROAR_VIO_DSTR_OBJT_TCP            (0x21|ROAR_VIO_DSTR_OBJGT_SOCKET)
+#define ROAR_VIO_DSTR_OBJT_UDP            (0x22|ROAR_VIO_DSTR_OBJGT_SOCKET)
+#define ROAR_VIO_DSTR_OBJT_TCP6           (0x31|ROAR_VIO_DSTR_OBJGT_SOCKET)
+#define ROAR_VIO_DSTR_OBJT_UDP6           (0x32|ROAR_VIO_DSTR_OBJGT_SOCKET)
+*/
+   case ROAR_VIO_DSTR_OBJT_UNIX:
+     c->need_vio = 0;
+     next->def = &(next->store_def);
+
+     if ( c->def != NULL ) {
+      roar_vio_dstr_init_defaults(next->def, ROAR_VIO_DEF_TYPE_SOCKET, c->def->o_flags, c->def->o_mode);
+     } else {
+      roar_vio_dstr_init_defaults(next->def, ROAR_VIO_DEF_TYPE_SOCKET, O_WRONLY, 0644);
+     }
+
+     if ( roar_vio_socket_init_unix_def(next->def, c->dst) == -1 )
+      return -1;
+    break;
    default:
     return -1;
Index: libroar/vio_socket.c
===================================================================
--- libroar/vio_socket.c	(revision 1332)
+++ libroar/vio_socket.c	(revision 1333)
@@ -35,11 +35,153 @@
 #include "libroar.h"
 
-int     roar_vio_open_def_socket          (struct roar_vio_calls * calls, struct roar_vio_defaults * def);
+int     roar_vio_open_def_socket          (struct roar_vio_calls * calls, struct roar_vio_defaults * def) {
+ int       fh  = -1;
+ socklen_t len =  0;
 
-int     roar_vio_socket_init_unix_def     (struct roar_vio_defaults * def, char * path);
+ if ( calls == NULL || def == NULL )
+  return -1;
+
+ if ( def->type != ROAR_VIO_DEF_TYPE_SOCKET )
+  return -1;
+
+ switch (def->d.socket.domain) {
+  case AF_INET:
+    len = sizeof(struct sockaddr_in);
+
+    switch (def->d.socket.type) {
+     case SOCK_STREAM:
+       fh = roar_socket_new_tcp();
+      break;
+     case SOCK_DGRAM:
+       fh = roar_socket_new_udp();
+      break;
+     default:
+       return -1;
+    }
+   break;
+#ifdef ROAR_HAVE_UNIX
+  case AF_UNIX:
+    len = sizeof(struct sockaddr_un);
+
+    switch (def->d.socket.type) {
+     case SOCK_STREAM:
+       fh = roar_socket_new_unix();
+      break;
+     case SOCK_DGRAM:
+       return -1;
+      break;
+     default:
+       return -1;
+    }
+   break;
+#endif
+#ifdef ROAR_HAVE_LIBDNET
+  case AF_DECnet:
+    len = sizeof(struct sockaddr_dn);
+
+    return -1;
+   break;
+#endif
+#ifdef ROAR_HAVE_IPV6
+  case AF_INET6:
+    len = sizeof(struct sockaddr_in6);
+
+    switch (def->d.socket.type) {
+     case SOCK_STREAM:
+       fh = roar_socket_new_tcp6();
+      break;
+     case SOCK_DGRAM:
+       fh = roar_socket_new_udp6();
+      break;
+     default:
+       return -1;
+    }
+   break;
+#endif
+#ifdef ROAR_HAVE_IPX
+  case AF_IPX:
+    len = sizeof(struct sockaddr_ipx);
+
+    return -1;
+   break;
+#endif
+  default:
+    return -1;
+ }
+
+ if ( fh == -1 )
+  return -1;
+
+ if ( connect(fh, &(def->d.socket.sa.sa), len) == -1 ) {
+  close(fh);
+  return -1;
+ }
+
+ if ( roar_vio_open_fh_socket(calls, fh) == -1 ) {
+  close(fh);
+  return -1;
+ }
+
+ return 0;
+}
+
+int     roar_vio_socket_init_socket_def   (struct roar_vio_defaults * def, int domain, int type) {
+ if ( def == NULL || domain == -1 || type == -1 )
+  return -1;
+
+ // we do not memset(def, 0, sizeof(...)) here
+ // because this is allready done in roar_vio_dstr_init_defaults()
+ // if we would be would override o_flags/o_mode and maybe others
+
+ memset(&(def->d.socket.sa), 0, sizeof(def->d.socket.sa));
+
+ def->type                     = ROAR_VIO_DEF_TYPE_SOCKET;
+ def->d.socket.domain          = domain;
+ def->d.socket.type            = type;
+ def->d.socket.sa.sa.sa_family = domain;
+
+ return 0;
+}
+
+int     roar_vio_socket_init_unix_def     (struct roar_vio_defaults * def, char * path) {
+ if ( roar_vio_socket_init_socket_def(def, AF_UNIX, SOCK_STREAM) == -1 )
+  return -1;
+
+ strncpy(def->d.socket.sa.un.sun_path, path, sizeof(def->d.socket.sa.un.sun_path) - 1);
+
+ return 0;
+}
+
 int     roar_vio_socket_init_decnet_def   (struct roar_vio_defaults * def, char * node, int object, char * objname);
 
-int     roar_vio_socket_init_inet4host_def(struct roar_vio_defaults * def, char * host);
-int     roar_vio_socket_init_tcp4_def     (struct roar_vio_defaults * def, char * host, int port);
+int     roar_vio_socket_init_inet4host_def(struct roar_vio_defaults * def, char * host) {
+ struct hostent     * he;
+
+ if ( def == NULL || host == NULL )
+  return -1;
+
+ if ( (he = gethostbyname(host)) == NULL ) {
+  ROAR_ERR("roar_vio_socket_init_inet4host_def(*): Can\'t resolve host name '%s'",
+                    host);
+  return -1;
+ }
+
+ memcpy((struct in_addr *)&def->d.socket.sa.in.sin_addr, he->h_addr, sizeof(struct in_addr));
+
+ return 0;
+}
+
+int     roar_vio_socket_init_tcp4_def     (struct roar_vio_defaults * def, char * host, int port) {
+ if ( roar_vio_socket_init_socket_def(def, AF_INET, SOCK_STREAM) == -1 )
+  return -1;
+
+ if ( roar_vio_socket_init_inet4host_def(def, host) == -1 )
+  return -1;
+
+ def->d.socket.sa.in.sin_port   = ROAR_HOST2NET16(port);
+
+ return 0;
+}
+
 int     roar_vio_socket_init_udp4_def     (struct roar_vio_defaults * def, char * host, int port);
 int     roar_vio_socket_init_inet6host_def(struct roar_vio_defaults * def, char * host);
