- f->fd = accept(fd, (struct sockaddr *) addr, &socklen);
- if (f->fd < 0) {
- td_verror(td, errno, "accept");
- return 1;
- }
- accepts++;
- break;
+ return 0;
+}
+
+
+static int fio_netio_open_file(struct thread_data *td, struct fio_file *f)
+{
+ if (td_read(td))
+ return fio_netio_accept(td, f);
+ else
+ return fio_netio_connect(td, f);
+}
+
+static int fio_netio_setup_connect(struct thread_data *td, const char *host,
+ unsigned short port)
+{
+ struct netio_data *nd = td->io_ops->data;
+
+ nd->addr.sin_family = AF_INET;
+ nd->addr.sin_port = htons(port);
+
+ if (inet_aton(host, &nd->addr.sin_addr) != 1) {
+ struct hostent *hent;
+
+ hent = gethostbyname(host);
+ if (!hent) {
+ td_verror(td, errno, "gethostbyname");
+ return 1;