+Socket::Socket(SocketHandle h, const SockAddr &paddr):
+ handle(h),
+ connected(true),
+ local_addr(0),
+ peer_addr(paddr.copy())
+{
+ sockaddr sa;
+ socklen_t size=sizeof(sockaddr);
+ getsockname(handle, &sa, &size);
+ local_addr=SockAddr::create(sa);
+
+#ifdef WIN32
+ event=CreateEvent(0, false, false, 0);
+#endif
+}
+
+Socket::Socket(Family af, int type, int proto):
+ connected(false),
+ local_addr(0),
+ peer_addr(0)
+{
+ handle=socket(af, type, proto);
+
+#ifdef WIN32
+ event=CreateEvent(0, false, false, 0);
+#endif
+}
+
+Socket::~Socket()
+{
+ close();
+}
+