diff -urNp gstreamer/libs/gst/net/gstnetclientclock.c gstreamer.win/libs/gst/net/gstnetclientclock.c
--- gstreamer/libs/gst/net/gstnetclientclock.c	2006-06-23 16:16:46.000000000 +0300
+++ gstreamer.win/libs/gst/net/gstnetclientclock.c	2006-09-01 14:48:30.000000000 +0300
@@ -2,6 +2,7 @@
  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
  *                    2005 Wim Taymans <wim@fluendo.com>
  *                    2005 Andy Wingo <wingo@pobox.com>
+ *                    2006 Joni Valtanen <joni.valtanen@movial.fi>
  *
  * gstnetclientclock.h: clock that synchronizes itself to a time provider over
  * the network
@@ -89,6 +90,10 @@ G_STMT_START {                          
 #define DEFAULT_PORT            5637
 #define DEFAULT_TIMEOUT         GST_SECOND
 
+#ifdef G_OS_WIN32
+#define getsockname(sock,addr,len) getsockname(sock,addr,(int *)len)
+#endif
+
 enum
 {
   PROP_0,
@@ -110,6 +115,16 @@ static void gst_net_client_clock_get_pro
 
 static void gst_net_client_clock_stop (GstNetClientClock * self);
 
+static int inet_aton(const char *c, struct in_addr* paddr)
+{
+  paddr->s_addr = inet_addr( c );
+    
+  if( paddr->s_addr == INADDR_NONE )
+          return 0;
+
+  return 1;
+}
+
 static void
 gst_net_client_clock_base_init (gpointer g_class)
 {
@@ -143,6 +158,19 @@ gst_net_client_clock_init (GstNetClientC
 {
   GstClock *clock = GST_CLOCK_CAST (self);
 
+#ifdef G_OS_WIN32
+  WSADATA w; 
+  int error = WSAStartup (0x0202, &w);
+ 
+  if (error) {
+     GST_DEBUG_OBJECT (self, "Error on WSAStartup");
+
+  } 
+  if (w.wVersion != 0x0202) { 
+     WSACleanup ();
+  }
+#endif
+
   self->port = DEFAULT_PORT;
   self->address = g_strdup (DEFAULT_ADDRESS);
 
@@ -180,6 +208,10 @@ gst_net_client_clock_finalize (GObject *
   g_free (self->servaddr);
   self->servaddr = NULL;
 
+#ifdef G_OS_WIN32
+  WSACleanup ();
+#endif
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -283,9 +315,16 @@ gst_net_client_clock_do_select (GstNetCl
 
       diff = gst_clock_get_internal_time (GST_CLOCK (self));
       GST_TIME_TO_TIMEVAL (self->current_timeout, tv);
-
+#ifdef G_OS_WIN32
+    if( ( ( max_sock + 1 ) != READ_SOCKET (self) ) || 
+        ( ( max_sock + 1 ) != WRITE_SOCKET (self) ) ) {
+        ret = select (max_sock + 1, readfds, NULL, NULL,  (struct timeval *) ptv );
+    } else {
+        ret = 1;
+    }
+#else
       ret = select (max_sock + 1, readfds, NULL, NULL, (struct timeval *) ptv);
-
+#endif
       diff = gst_clock_get_internal_time (GST_CLOCK (self)) - diff;
 
       if (diff > self->current_timeout)
@@ -446,7 +485,7 @@ gst_net_client_clock_start (GstNetClient
   self->sock = ret;
 
   len = sizeof (myaddr);
-  ret = getsockname (self->sock, (struct sockaddr *) &myaddr, &len);
+  ret = getsockname(self->sock, (struct sockaddr *) &myaddr, &len);
   if (ret < 0)
     goto getsockname_error;
 
@@ -569,13 +608,19 @@ gst_net_client_clock_new (gchar * name, 
       g_warning ("unable to set the base time, expect sync problems!");
   }
 
+#ifdef G_OS_WIN32
+  GST_DEBUG_OBJECT (ret, "creating pipe");
+  if ((iret = pipe( CONTROL_SOCKETS (ret) ) ) < 0)
+   goto no_socket_pair;
+
+#else
   GST_DEBUG_OBJECT (ret, "creating socket pair");
   if ((iret = socketpair (PF_UNIX, SOCK_STREAM, 0, CONTROL_SOCKETS (ret))) < 0)
     goto no_socket_pair;
 
   fcntl (READ_SOCKET (ret), F_SETFL, O_NONBLOCK);
   fcntl (WRITE_SOCKET (ret), F_SETFL, O_NONBLOCK);
-
+#endif
   if (!gst_net_client_clock_start (ret))
     goto failed_start;
 
diff -urNp gstreamer/libs/gst/net/gstnetclientclock.h gstreamer.win/libs/gst/net/gstnetclientclock.h
--- gstreamer/libs/gst/net/gstnetclientclock.h	2006-06-01 21:22:14.000000000 +0300
+++ gstreamer.win/libs/gst/net/gstnetclientclock.h	2006-09-01 14:40:42.000000000 +0300
@@ -34,11 +34,15 @@ G_BEGIN_DECLS
 #include <errno.h>
 #include <string.h>
 #include <sys/types.h>
+
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#else
 #include <netdb.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-
+#endif
 #include <fcntl.h>
 
 #define GST_TYPE_NET_CLIENT_CLOCK \
diff -urNp gstreamer/libs/gst/net/gstnettimepacket.c gstreamer.win/libs/gst/net/gstnettimepacket.c
--- gstreamer/libs/gst/net/gstnettimepacket.c	2006-04-11 21:43:04.000000000 +0300
+++ gstreamer.win/libs/gst/net/gstnettimepacket.c	2006-09-01 14:53:52.000000000 +0300
@@ -32,6 +32,8 @@
 #include "config.h"
 #endif
 
+#include <glib.h>
+
 #ifdef __CYGWIN__
 # include <unistd.h>
 # include <fcntl.h>
@@ -171,6 +173,10 @@ gst_net_time_packet_send (const GstNetTi
 {
 #ifdef __CYGWIN__
   gint fdflags;
+#else
+#ifdef G_OS_WIN32
+  gulong flags;
+#endif
 #endif
   guint8 *buffer;
   gint ret, send_flags;
@@ -182,12 +188,21 @@ gst_net_time_packet_send (const GstNetTi
   fdflags = fcntl (fd, F_GETFL);
   fcntl (fd, F_SETFL, fdflags | O_NONBLOCK);
 #else
+#ifdef G_OS_WIN32
+  flags=1;
+#else
   send_flags = MSG_DONTWAIT;
 #endif
+#endif
 
   buffer = gst_net_time_packet_serialize (packet);
 
+#ifdef G_OS_WIN32
+  ioctlsocket( fd, FIONBIO, &flags ); /* Set nonblocking mode */
+  ret = sendto (fd, buffer, GST_NET_TIME_PACKET_SIZE, NULL, addr, len);
+#else
   ret = sendto (fd, buffer, GST_NET_TIME_PACKET_SIZE, send_flags, addr, len);
+#endif
 
 #ifdef __CYGWIN__
   fcntl (fd, F_SETFL, fdflags);
diff -urNp gstreamer/libs/gst/net/gstnettimepacket.h gstreamer.win/libs/gst/net/gstnettimepacket.h
--- gstreamer/libs/gst/net/gstnettimepacket.h	2005-11-23 18:10:38.000000000 +0200
+++ gstreamer.win/libs/gst/net/gstnettimepacket.h	2006-09-01 14:44:29.000000000 +0300
@@ -28,10 +28,16 @@ G_BEGIN_DECLS
 #include <errno.h>
 #include <string.h>
 #include <sys/types.h>
+
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#else
 #include <netdb.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#endif
 
 /**
  * GST_NET_TIME_PACKET_SIZE:
diff -urNp gstreamer/libs/gst/net/gstnettimeprovider.c gstreamer.win/libs/gst/net/gstnettimeprovider.c
--- gstreamer/libs/gst/net/gstnettimeprovider.c	2006-06-23 16:16:46.000000000 +0300
+++ gstreamer.win/libs/gst/net/gstnettimeprovider.c	2006-09-01 14:58:58.000000000 +0300
@@ -1,5 +1,6 @@
 /* GStreamer
  * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
+ *               2006 Joni Valtanen <joni.valtanen@movial.fi>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -42,8 +43,12 @@
 #include "gstnettimeprovider.h"
 #include "gstnettimepacket.h"
 
+#include <glib.h>
+
 #include <unistd.h>
+#ifndef G_OS_WIN32
 #include <sys/ioctl.h>
+#endif
 
 #ifdef HAVE_FIONREAD_IN_SYS_FILIO
 #include <sys/filio.h>
@@ -60,6 +65,10 @@ GST_DEBUG_CATEGORY_STATIC (ntp_debug);
 #define WRITE_SOCKET(self)      self->control_sock[1]
 #define READ_SOCKET(self)       self->control_sock[0]
 
+#ifdef G_OS_WIN32
+#define close(sock) closesocket(sock)
+#endif
+
 #define SEND_COMMAND(self, command)                     \
 G_STMT_START {                                  \
   unsigned char c; c = command;                 \
@@ -76,6 +85,9 @@ G_STMT_START {                          
 
 #define IS_ACTIVE(self) (g_atomic_int_get (&((self)->active.active)))
 
+#ifdef G_OS_WIN32
+#define setsockopt(sock, sol_flags, reuse_flags, ru, sizeofru) setsockopt (sock, sol_flags, reuse_flags, (char *)ru, sizeofru)
+#endif
 enum
 {
   PROP_0,
@@ -103,6 +115,18 @@ static void gst_net_time_provider_get_pr
 GST_BOILERPLATE_FULL (GstNetTimeProvider, gst_net_time_provider, GstObject,
     GST_TYPE_OBJECT, _do_init);
 
+
+static int inet_aton(const char *c, struct in_addr* paddr)
+{
+
+  paddr->s_addr = inet_addr( c );
+    
+  if( paddr->s_addr == INADDR_NONE )
+          return 0;
+
+  return 1;
+}
+
 static void
 gst_net_time_provider_base_init (gpointer g_class)
 {
@@ -142,6 +166,19 @@ static void
 gst_net_time_provider_init (GstNetTimeProvider * self,
     GstNetTimeProviderClass * g_class)
 {
+#ifdef G_OS_WIN32
+  WSADATA w; 
+  int error = WSAStartup (0x0202, &w);
+ 
+  if (error) {
+    GST_DEBUG_OBJECT (self, "Error on WSAStartup");
+
+  } 
+  if (w.wVersion != 0x0202) { 
+    WSACleanup ();
+  }
+#endif
+
   self->port = DEFAULT_PORT;
   self->sock = -1;
   self->address = g_strdup (DEFAULT_ADDRESS);
@@ -176,6 +213,10 @@ gst_net_time_provider_finalize (GObject 
     gst_object_unref (self->clock);
   self->clock = NULL;
 
+#ifdef G_OS_WIN32
+  WSACleanup (); 
+#endif
+
   G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -197,7 +238,16 @@ gst_net_time_provider_thread (gpointer d
     max_sock = MAX (self->sock, READ_SOCKET (self));
 
     GST_LOG_OBJECT (self, "doing select");
+#ifdef G_OS_WIN32
+    if( ( ( max_sock + 1 ) != READ_SOCKET (self) ) || 
+        ( ( max_sock + 1 ) != WRITE_SOCKET (self) ) ) {
+        ret = select (max_sock + 1, &read_fds, NULL, NULL, NULL);
+    } else {
+        ret = 1;
+    }
+#else
     ret = select (max_sock + 1, &read_fds, NULL, NULL, NULL);
+#endif
     GST_LOG_OBJECT (self, "select returned %d", ret);
 
     if (ret <= 0) {
@@ -473,11 +523,14 @@ gst_net_time_provider_new (GstClock * cl
       address, "port", port, NULL);
 
   GST_DEBUG_OBJECT (ret, "creating socket pair");
+#ifdef G_OS_WIN32
+  if ((iret = pipe( CONTROL_SOCKETS (ret) ) ) < 0)
+#else
   if ((iret = socketpair (PF_UNIX, SOCK_STREAM, 0, CONTROL_SOCKETS (ret))) < 0)
     goto no_socket_pair;
-
   fcntl (READ_SOCKET (ret), F_SETFL, O_NONBLOCK);
   fcntl (WRITE_SOCKET (ret), F_SETFL, O_NONBLOCK);
+#endif
 
   if (!gst_net_time_provider_start (ret))
     goto failed_start;
diff -urNp gstreamer/libs/gst/net/gstnettimeprovider.h gstreamer.win/libs/gst/net/gstnettimeprovider.h
--- gstreamer/libs/gst/net/gstnettimeprovider.h	2006-06-01 21:22:14.000000000 +0300
+++ gstreamer.win/libs/gst/net/gstnettimeprovider.h	2006-09-01 14:11:21.000000000 +0300
@@ -1,5 +1,6 @@
 /* GStreamer
  * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
+ *               2006 Joni Valtanen <joni.valtanen@movial.fi>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -21,6 +22,9 @@
 #ifndef __GST_NET_TIME_PROVIDER_H__
 #define __GST_NET_TIME_PROVIDER_H__
 
+/* to determinate os */
+#include <glib.h>
+
 #include <gst/gst.h>
 
 G_BEGIN_DECLS
@@ -28,10 +32,15 @@ G_BEGIN_DECLS
 #include <errno.h>
 #include <string.h>
 #include <sys/types.h>
+
+#ifdef G_OS_WIN32
+#include <winsock2.h>
+#else
 #include <netdb.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#endif
 
 #include <fcntl.h>
 
