help-smalltalk
[Top][All Lists]
Advanced

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

[Fwd: Re: [Help-smalltalk] [BUG?] Missing second byte -nextHunk (again)]


From: Sungjin Chun
Subject: [Fwd: Re: [Help-smalltalk] [BUG?] Missing second byte -nextHunk (again)]
Date: Wed, 07 Mar 2007 20:38:14 +0900
User-agent: Thunderbird 1.5.0.10 (X11/20070306)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Is this problem - if not problem, then why this occurs? - solved/tracked ?

Thanks in advance.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF7qQmQqspS1+XJHgRAlJVAKDEuVEPHy0ZUCpp/ryp8QhmYaayfQCgwam4
+WzICM8DtNqgVhOofDoaEWc=
=1SUl
-----END PGP SIGNATURE-----
--- Begin Message --- Subject: Re: [Help-smalltalk] [BUG?] Missing second byte -nextHunk (again) Date: Mon, 05 Mar 2007 10:32:28 +0900 User-agent: Thunderbird 1.5.0.9 (X11/20070104)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

Attached file is simple echo server and I did test with nc(netcat)
like this;

echo -e "hello\r\n" | nc localhost 8123

again, which returns "hllo" instead of correct "hello".

Thanks in advance.

Paolo Bonzini wrote:
> Can you please send the source code?
> 
> Thanks,
> 
> Paolo

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFF63MrQqspS1+XJHgRAu0HAKCDosZPK6glYOSEDSnC8CMe9U/AWgCWOtLc
1SxbzA+tTyIg76Iw0F7Ytw==
=G+GN
-----END PGP SIGNATURE-----
"Filed out from GNU Smalltalk version 2.2b on 26-Oct-2006  10:30:02"!

Smalltalk.Object subclass: #SocketTest
        instanceVariableNames: 'buffer socket '
        classVariableNames: ''
        poolDictionaries: ''
        category: nil!

SocketTest comment: 
nil!

!SocketTest class methodsFor: 'instance creation'!

new
  | n |
  n := super new.
  n init.
  ^n
! !

!SocketTest methodsFor: 'basic'!

handle: sock
   | hunk | 
   [
      [
         [ sock atEnd ] whileFalse: [
             hunk := sock nextHunk.
             "Transcript show: sock readBuffer; cr.
             hunk := sock upTo: Character cr.
             Transcript show: hunk; cr."
             sock nextPutAll: hunk.
             sock flush.
             sock close.
         ].
      ] ensure: [ sock close ]
   ] fork
!

init
   buffer := String new
!

run
   'Starting server...' displayNl.
   socket := TCP.ServerSocket port: 8123.
   socket isNil ifTrue: [ self error: 'couldn''t create ServerSocket!' ].
   [
      socket waitForConnection.
      'Got connection!' displayNl.
      self handle: (socket accept)
   ] repeat
!

start
   self run.
   "[self run] fork." "OOPS!, this does not work on GST!!!"
!

stop
   socket close
! !

SocketTest new start!

--- End Message ---

reply via email to

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