help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] Re: Question regarding DatagramSocket...


From: Paolo Bonzini
Subject: [Help-smalltalk] Re: Question regarding DatagramSocket...
Date: Fri, 11 Jun 2010 17:33:09 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b2pre Thunderbird/3.0.4

On 06/11/2010 05:16 PM, Holger Hans Peter Freyther wrote:
+    payloadSize [
+       <comment: 'I determine the payload size.'>
+        <category: 'accessing'>
+        dataSize isNil
+           ifTrue: [^data size]
+           ifFalse: [^dataSize]
+    ]

Just name it "size" please. There is no <comment: ''> pragma in methods. Finally, please put a single ^ outside the if blocks.

However, this part is good to commit for 3.2.1.

      get [
        "Parse the data attached to the datagram through a newly created
         ObjectDumper, and answer the resulting object.  This method is
diff --git a/packages/sockets/Sockets.st b/packages/sockets/Sockets.st
index a279c42..a1033ee 100644
--- a/packages/sockets/Sockets.st
+++ b/packages/sockets/Sockets.st
@@ -631,6 +631,20 @@ but it is done for cleanliness and symmetry.'>
        port: remotePort
      ]

+    DatagramSocket class>>  addressFromString: ipAddressOrString [
+       | addr |
+
+       ipAddressOrString isString
+           ifTrue: [
+               addr := SocketAddress byName: ipAddressOrString.
+               addr isNil
+                   ifTrue:
+                       [self error: 'cannot resolve host name ' , 
ipAddressOrString printString]]
+           ifFalse: [addr := ipAddressOrString].
+
+       ^ addr
+    ]
+

This should go to a (very high) superclass as you suspected.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]