[Gambas-user] Net Socket timing issue?

Eric Budd ericbudd at ...407...
Fri Jan 14 21:02:18 CET 2005


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

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! :)





More information about the User mailing list