Index: uspace/lib/c/generic/inet.c
===================================================================
--- uspace/lib/c/generic/inet.c	(revision ecff3d9a17c6c882ad241671cff1a314da4c4f16)
+++ uspace/lib/c/generic/inet.c	(revision 59157eb35e6e9c10dc18e144c444d8d35d9453ef)
@@ -148,4 +148,23 @@
 }
 
+static void inet_ev_recv(ipc_callid_t callid, ipc_call_t *call)
+{
+	int rc;
+	inet_dgram_t dgram;
+
+	dgram.src.ipv4 = IPC_GET_ARG1(*call);
+	dgram.dest.ipv4 = IPC_GET_ARG2(*call);
+	dgram.tos = IPC_GET_ARG3(*call);
+
+	rc = async_data_write_accept(&dgram.data, false, 0, 0, 0, &dgram.size);
+	if (rc != EOK) {
+		async_answer_0(callid, rc);
+		return;
+	}
+
+	rc = inet_ev_ops->recv(&dgram);
+	async_answer_0(callid, rc);
+}
+
 static void inet_cb_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
 {
@@ -153,13 +172,13 @@
 		ipc_call_t call;
 		ipc_callid_t callid = async_get_call(&call);
-		
+
 		if (!IPC_GET_IMETHOD(call)) {
 			/* TODO: Handle hangup */
 			return;
 		}
-		
+
 		switch (IPC_GET_IMETHOD(call)) {
 		case INET_EV_RECV:
-			async_answer_0(callid, EOK);
+			inet_ev_recv(callid, &call);
 			break;
 		default:
Index: uspace/srv/inet/inet.c
===================================================================
--- uspace/srv/inet/inet.c	(revision ecff3d9a17c6c882ad241671cff1a314da4c4f16)
+++ uspace/srv/inet/inet.c	(revision 59157eb35e6e9c10dc18e144c444d8d35d9453ef)
@@ -47,12 +47,7 @@
 #include <sys/types.h>
 
+#include "inet.h"
+
 #define NAME "inet"
-
-/** Inet Client */
-typedef struct {
-	async_sess_t *sess;
-	uint8_t protocol;
-	link_t client_list;
-} inet_client_t;
 
 static void inet_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg);
@@ -111,28 +106,21 @@
     ipc_call_t *call)
 {
-	uint32_t src_ipv4;
-	uint32_t dest_ipv4;
-	uint8_t tos;
+	inet_dgram_t dgram;
 	uint8_t ttl;
 	int df;
-	void *data;
-	size_t size;
 	int rc;
 
 	log_msg(LVL_DEBUG, "inet_send()");
 
-	src_ipv4 = IPC_GET_ARG1(*call);
-	dest_ipv4 = IPC_GET_ARG2(*call);
-	tos = IPC_GET_ARG3(*call);
+	dgram.src.ipv4 = IPC_GET_ARG1(*call);
+	dgram.dest.ipv4 = IPC_GET_ARG2(*call);
+	dgram.tos = IPC_GET_ARG3(*call);
 	ttl = IPC_GET_ARG4(*call);
 	df = IPC_GET_ARG5(*call);
 
-	(void)src_ipv4;
-	(void)dest_ipv4;
-	(void)tos;
 	(void)ttl;
 	(void)df;
 
-	rc = async_data_write_accept(&data, false, 0, 0, 0, &size);
+	rc = async_data_write_accept(&dgram.data, false, 0, 0, 0, &dgram.size);
 	if (rc != EOK) {
 		async_answer_0(callid, rc);
@@ -140,5 +128,5 @@
 	}
 
-	free(data);
+	free(dgram.data);
 	async_answer_0(callid, ENOTSUP);
 }
@@ -223,4 +211,27 @@
 }
 
+int inet_ev_recv(inet_client_t *client, inet_dgram_t *dgram)
+{
+	async_exch_t *exch = async_exchange_begin(client->sess);
+
+	ipc_call_t answer;
+	aid_t req = async_send_3(exch, INET_EV_RECV, dgram->src.ipv4,
+	    dgram->dest.ipv4, dgram->tos, &answer);
+	int rc = async_data_write_start(exch, dgram->data, dgram->size);
+	async_exchange_end(exch);
+
+	if (rc != EOK) {
+		async_wait_for(req, NULL);
+		return rc;
+	}
+
+	sysarg_t retval;
+	async_wait_for(req, &retval);
+	if (retval != EOK)
+		return retval;
+
+	return EOK;
+}
+
 int main(int argc, char *argv[])
 {
Index: uspace/srv/inet/inet.h
===================================================================
--- uspace/srv/inet/inet.h	(revision 59157eb35e6e9c10dc18e144c444d8d35d9453ef)
+++ uspace/srv/inet/inet.h	(revision 59157eb35e6e9c10dc18e144c444d8d35d9453ef)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2012 Jiri Svoboda
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup inet
+ * @{
+ */
+/**
+ * @file
+ * @brief
+ */
+
+#ifndef INET_H_
+#define INET_H_
+
+#include <adt/list.h>
+#include <sys/types.h>
+#include <async.h>
+
+/** Inet Client */
+typedef struct {
+	async_sess_t *sess;
+	uint8_t protocol;
+	link_t client_list;
+} inet_client_t;
+
+typedef struct {
+	uint32_t ipv4;
+} inet_addr_t;
+
+typedef struct {
+	inet_addr_t src;
+	inet_addr_t dest;
+	uint8_t tos;
+	void *data;
+	size_t size;
+} inet_dgram_t;
+
+extern int inet_ev_recv(inet_client_t *, inet_dgram_t *);
+
+#endif
+
+/** @}
+ */
Index: uspace/srv/tcp/tcp.c
===================================================================
--- uspace/srv/tcp/tcp.c	(revision ecff3d9a17c6c882ad241671cff1a314da4c4f16)
+++ uspace/srv/tcp/tcp.c	(revision 59157eb35e6e9c10dc18e144c444d8d35d9453ef)
@@ -54,4 +54,6 @@
 #define NAME       "tcp"
 
+#define IP_PROTO_TCP 6
+
 static int tcp_inet_ev_recv(inet_dgram_t *dgram);
 static void tcp_received_pdu(tcp_pdu_t *pdu);
@@ -185,5 +187,5 @@
 	if (0) tcp_test();
 
-	rc = inet_init(42, &tcp_inet_ev_ops);
+	rc = inet_init(IP_PROTO_TCP, &tcp_inet_ev_ops);
 	if (rc != EOK) {
 		log_msg(LVL_ERROR, "Failed connecting to internet service.");
