Hello.

So my question not about how to do it. But how to not copy another time
classic incoming connections loop.
I not found ready solution. So I created simplest TCPServer project
<http://smalltalkhub.com/#!/~Pharo/TCPServer>with good tests. Now you can
subclass TCPServer and implement single method #processNewConnection:.
That's all.

(Not release version yet. There is only development version)

Best regards,
Denis

2015-12-17 18:53 GMT+01:00 Hernán Morales Durand <[email protected]>:

> Hi Denis,
>
> There is
>
> http://www.squeaksource.com/SocketExamples.html
> http://www.squeaksource.com/Net.html
>
> Last one seems a lot of interesting work.
>
> or look for #remoteTestServerTCP which was in OldSocket or Socket some
> time ago:
>
> remoteTestServerTCP
>     "See remoteTestClientTCP for instructions on running this method."
>     "OldSocket remoteTestServerTCP"
>
>     | socket client buffer n |
>     Transcript show: 'initializing network ... '.
>     Socket initializeNetwork.
>     Transcript show:'ok';cr.
>     socket _ OldSocket newTCP.
>     socket
>         listenOn: 54321
>         backlogSize: 5
>         interface: (NetNameResolver addressFromString: '127.0.0.1'). "or:
> 0.0.0.0"
>     Transcript show: 'server endpoint created -- run client test in other
> image'; cr.
>     buffer _ String new: 4000.
>     socket waitForConnectionUntil: self standardDeadline.
>     client _ socket accept.
>     [client isConnected] whileTrue: [
>         client dataAvailable ifTrue:
>             [n _ client    receiveDataInto: buffer.
>             client sendData: buffer count: n]].
>     client closeAndDestroy.
>     socket closeAndDestroy.
>     Transcript cr; show: 'server endpoint destroyed'; cr.
>     ^socket
>
> Cheers,
>
> Hernán
>
>
> 2015-12-10 8:07 GMT-03:00 Denis Kudriashov <[email protected]>:
>
>> Hi.
>>
>> I need simple TCP server which process incoming connection in separate
>> processes.
>> I see Zinc ZnServer subclasses implement something like that. But I'm not
>> sure that it is good idea to reuse it. Zinc server has http related methods
>> which I'm not need.
>>
>> What you think?
>>
>> (I don't want to implement another one incoming connections loop)
>>
>
>

Reply via email to