attempted to reorganize listen: to listen:do:

This commit is contained in:
hyunghwan.chung 2018-01-30 15:11:42 +00:00
parent 165fe93e5e
commit 51e7d93f63

View File

@ -239,7 +239,7 @@ class Socket(Object) from 'sck'
method(#primitive) open(domain, type, proto).
method(#primitive) _close.
method(#primitive) bind: addr.
method(#primitive) listen: backlog.
method(#primitive) _listen: backlog.
method(#primitive) accept: addr.
method(#primitive) _connect: addr.
method(#primitive) _socketError.
@ -296,6 +296,13 @@ extend Socket
}
}
method listen: backlog do: acceptBlock
{
self.inputAction := acceptBlock.
self watchInput.
^self _listen: backlog.
}
method connectTo: target do: connectBlock
{
| s1 s2 sa |
@ -574,9 +581,13 @@ error -> exception
s connectTo: (SocketAddress fromString: '127.0.0.1:9999') do: conact.
s2 := Socket domain: Socket.Domain.INET type: Socket.Type.STREAM.
s2 inputAction: accact.
s2 bind: (SocketAddress fromString: '0.0.0.0:9998').
s2 listen: 10; watchInput.
##s2 inputAction: accact.
###s2 listen: 10; watchInput.
s2 listen: 10 do: accact.
### when there is an exception something is not right....
Exception signal: 'XXXXXXXXXX'.
while (true)
{