[Gambas-user] Socket not working in 2.8
nospam.nospam.nospam at ...626...
nospam.nospam.nospam at ...626...
Sun Oct 4 15:57:03 CEST 2009
On Sun, 2009-10-04 at 21:17 +0800, Werner wrote:
> PRIVATE MySock AS Socket
>
>
> PUBLIC SUB Form_Open()
> MySock = NEW Socket 'the socket is now
> created. Stream is closed
> MySock.Connect("localhost", 7000) 'does open the stream.
> END
>
> I cannot reproduce the symptoms described.
I upgraded to 2.16 and still have the problem. MySock_Read doesn't fire.
There is an NNTP server on 192.168.1.8:5000 that sends back a greeting
when the connection is made by the client. The server logs also indicate
that no connection was made.
PRIVATE MySock AS Socket
PUBLIC SUB Form_Open()
MySock = NEW Socket
MySock.Connect("192.168.1.8", 5000)
END
PUBLIC SUB MySock_Read()
DIM sR AS String
DIM nZ AS Integer
IF MySock.Status = Net.Connected THEN
READ #MySock, sR, Lof(MySock)
END IF
END
If I put a Socket control on the form and use this code, it works.
MySock_Read fires and sR contains the greeting from the server.
PUBLIC SUB Form_Open()
MySock.Connect("192.168.1.8", 5000)
END
PUBLIC SUB MySock_Read()
DIM sR AS String
DIM nZ AS Integer
IF MySock.Status = Net.Connected THEN
READ #MySock, sR, Lof(MySock)
END IF
END
More information about the User
mailing list