- address = addrin.address
- init(addrin.port, hostname.h_name)
+ var hostent = sys.gethostbyname(host.to_cstring)
+ if hostent.address_is_null then
+ # Error in name lookup
+ var err = sys.h_errno
+ last_error = new IOError(err.to_s)
+
+ closed = true
+ end_reached = true
+
+ return
+ end
+
+ addrin = new NativeSocketAddrIn
+ addrin.fill_from_hostent hostent
+ addrin.port = port
+
+ address = addrin.address.to_s
+ init(addrin.port, hostent.h_name.to_s)