Socket.st
changeset 1110 0876a3d30fd2
parent 1035 5b0605675dc6
child 1112 b30ccede6078
--- a/Socket.st	Fri Oct 25 17:03:19 2002 +0200
+++ b/Socket.st	Mon Nov 04 10:15:37 2002 +0100
@@ -2171,6 +2171,16 @@
     "
 ! !
 
+!Socket methodsFor:'Compatibility - Dolphin'!
+
+setReceiveTimeout: milliseconds
+    self receiveTimeout:(milliseconds / 1000)
+!
+
+setSendTimeout: milliseconds
+    self sendTimeout:(milliseconds / 1000)
+! !
+
 !Socket methodsFor:'Compatibility - ST80'!
 
 acceptNonBlock
@@ -2251,6 +2261,34 @@
     ^ self getPeer
 ! !
 
+!Socket methodsFor:'accessing'!
+
+localAddress
+	"Answer an InternetAddress representing the address of the peer machine."
+
+	| winSockAddr winSockAddrLen result |
+	#swAdded.
+	winSockAddr := SOCKADDR_IN new.
+	winSockAddrLen := SDWORD new.
+	winSockAddrLen value: winSockAddr byteSize.
+	result := WSockLibrary default 
+				getsockname: self asParameter
+				name: winSockAddr
+				namelen: winSockAddrLen.
+	result = -1 ifTrue: [self error].
+	^InternetAddress ipAddress: winSockAddr sin_addr
+!
+
+swazooLogStream
+	#swAdded.
+	^SwazooLoggingStream socket: self
+!
+
+swazooStream
+	#swAdded.
+	^SwazooStream socket: self
+! !
+
 !Socket methodsFor:'datagram transmission'!
 
 receiveBuffer:aDataBuffer start:startIndex for:nBytes
@@ -4497,6 +4535,14 @@
     ^ filePointer notNil
 !
 
+isConnected
+    "return true, if the receiver has a connection"
+
+    ^ self isActive
+      and:[port notNil
+      and:[peerName notNil]]
+!
+
 port
     "return the port number (or name for unix-sockets) to which the socket is bound"
 
@@ -5114,5 +5160,5 @@
 !Socket class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.162 2002-04-09 14:58:01 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic2/Socket.st,v 1.163 2002-11-04 09:15:37 cg Exp $'
 ! !