[Gambas-user] Net Socket timing issue?

ericbudd at ...407... ericbudd at ...407...
Sat Jan 15 18:29:11 CET 2005


I tried your suggestion, which was interesting, because Ihad been concentrating on the "read" portion of the code.  HoweverI am still having the problem.  I did discover something interesting that may make it easier, tho...

In my socket wrapper class, I have the following code on the MySocket_Read event:

  READ #sM, LastBuf, Lof(sM)
  frmMain.txtConsole.Text = frmMain.txtConsole.Text & LastBuf

On the frmMain, the button which sends the command has the following code:

  sockMUSH.Write(ME.txtCommand.Text & Chr(10))
  txtConsole.Selection(Len(txtConsole.Text), 0) ' this line moves to the bottom of the display area

  So the button is clicked, the command is written, the console is correctly updated, but not until AFTER the selection command.  The code finishes executing before any data comes back on the port.

  Is there a way I can force the program to wait until a read has occurred and finished before continuing?

Thanks so much!



> 
> From: Daniel Campos <daniel.campos at ...338...>
> Date: 2005/01/15 Sat AM 01:08:50 GMT
> To: gambas-user at lists.sourceforge.net
> Subject: Re: [Gambas-user] Net Socket timing issue?
> 
> 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
> >
> >
> 
> 
> 
> -------------------------------------------------------
> 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