Sockets Streams and if Readavail

BlitzMax Forums/BlitzMax Beginners Area/Sockets Streams and if Readavail

BeardKingX(Posted 2013) [#1]
So I have a server created and am trying to read incoming lines.



in old blitz where the "???" is in the code above I could easily check to see if the player had sent anything by simply doing:

if readvail(this_player\stream) > 1

In Blitzmax there does not seem to be an equivalent and I have been unable to get socketreadavail to work in any fashion.


BeardKingX(Posted 2013) [#2]
this works... sort of, it only reads every other line sent for some reason




Floyd(Posted 2013) [#3]
You are calling ReadLine$(this_player.stream) twice. I think you want something like
Local msg:String = ReadLine$(this_player.stream)
If Len(msg) > 0
   Print msg
End If



BeardKingX(Posted 2013) [#4]
Thanks works perfectly. I probably should have caught that =P