tcp connection problem

Martin Baco mab at whitestein.com
Fri Aug 11 11:49:21 UTC 2000



squeak at sysa.barnett.sk wrote:

> Dear Mr. Baco,
>
> You should put more information about how you
> opened mentioned connection.
>
> Jan Barger
>
>  http://www.barnett.sk
>  http://www.napri.sk
>
> P.S.
>
> Maybe you will understand slovak language too :)
>
> Mozno mate otvorenych viac socketov. Nenapisali ste ako ste otvorili
> spojenie na jednej a druhej strane a ako ste ho potom uzavreli.
> Ale predpokladam ze neslo len o neake examples co su k socketom.
>

O.K. here you are:

"network initialization"
Socket initializeNetwork
ip  := NetNameResolver addressForName: 'localhost'.

"connection establishment"
s1 := Socket newTCP.
s2 := Socket newTCP.
s1 listenOn: 12345.
s2 connectTo: ip port: 12345.

"close connection on one side"
s1 close.

s2 sendData: 'some data'.                        "you can send data"
s2 getData.                                              "you can receive
empty string any times"
s2 getData.

s2 statusString.                                        "socket s2 is still
connected"


I ran this short example in Squeak 2.6 - 2.9alpha with pure images and I used
free port on my computer.


Martin Baco

PS:
    Yes I will ... a celkom mi to ide ;-)






More information about the Squeak-dev mailing list