G
Greg Chambers
Sorry to bother you guys about this again. So my main problem right now
is probably due to my lack of knowledge of the TCPSocket, even with the
documentation. I mean, all the methods I have read about either require
that I know the length I am reading ahead of time or that the only thing
the socket needs to be doing is reading. I need to be able to just get
all the data there is out of the socket, display it for the user, and
then accept a string from the user to send back to the server. The main
problem is the size of the strings sent back and forth are dependent on
the commands being sent by the user. If the user types in "help", then
the user will get back the whole help text file while if the user types
in "connections", the user will just get an integer of connections there
are.
So far, the best read method I have found for this is #readpartial but
there seems to be a catch. So I do the read right after the command is
sent. The problem here is often the data doesn't have enough time to
get returned before #readpartial determines there is no data to be read
and then prompts the user for the next command while showing no data.
However, after that command is sent, it then successfully shows the data
from two commands ago. Does anyone have any idea as how to fix my use
of #readpartial or maybe another method that will suit my needs?
is probably due to my lack of knowledge of the TCPSocket, even with the
documentation. I mean, all the methods I have read about either require
that I know the length I am reading ahead of time or that the only thing
the socket needs to be doing is reading. I need to be able to just get
all the data there is out of the socket, display it for the user, and
then accept a string from the user to send back to the server. The main
problem is the size of the strings sent back and forth are dependent on
the commands being sent by the user. If the user types in "help", then
the user will get back the whole help text file while if the user types
in "connections", the user will just get an integer of connections there
are.
So far, the best read method I have found for this is #readpartial but
there seems to be a catch. So I do the read right after the command is
sent. The problem here is often the data doesn't have enough time to
get returned before #readpartial determines there is no data to be read
and then prompts the user for the next command while showing no data.
However, after that command is sent, it then successfully shows the data
from two commands ago. Does anyone have any idea as how to fix my use
of #readpartial or maybe another method that will suit my needs?