[Gambas-user] Net Socket timing issue?

Daniel Campos daniel.campos at ...338...
Sat Jan 15 02:08:50 CET 2005


Eric Budd escribió:

> Hey guys-- first of all, GREAT job on Gambas-- I'm lovin' it :D
>
> I'm writing a minimal MUSH client to play around with some of the net 
> stuff, but i'm running into a problem.
>
> Whien I send a command with my socket object to my local MUSH test 
> server, it goes through fine.  When I try to read immediately after 
> writing, though, the buffer is not updated.
>
> I'm using the "Read" event to get data as follows:
>
> PUBLIC SUB mySocket_Read()
>  READ #sM, LastBuf, Lof(sM)
>  FullBuf = FullBuf & LastBuf
>  frmBufrWatch.txtBuffer.Text = frmBufrWatch.txtBuffer.Text & LastBuf
> END
>
> When I write a command to the socket, tho:
>
>  IF Len(Data) > 0 THEN
>    WRITE #sM, Data & Chr(10)
>  END IF


Try

WRITE #sM, Data & Chr(10), Len(Data)+1

>
> Then try to read the data into a textbox:
> ME.txtConsole.Text = ME.txtConsole.Text & LastBuf
>
> It doesn't come up with the new data unless I force the program to do 
> a Wait(1) before I read the "LastBuf" variable.  If I Wait(1) right 
> after the READ statement, it won't work-- just comes up with whatever 
> was already in LastBuf.  But the writing to  
> frmBufrWatch.txtBuffer.Text always works, whether I wait or not.
>
> Any ideas on why this is happening, and how I can get responses from 
> the server without having to put a Wait() in?
> Thanks! :)
>
>
>
> -------------------------------------------------------
> The SF.Net email is sponsored by: Beat the post-holiday blues
> Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
> It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>





More information about the User mailing list