C
calcop
Hello everyone,
Could someone please point me in the right direction? Here is my
problem. I have created a telnet server for a records management
system. To handle multi users, I made this server thread out each
connection. After threading the connection it threads out to handle the
user interaction. The connection thread is constantly reading data from
the socket and putting it into a variable contained into a class called
socketBuffer.
I have two functions to read data. They are getChar() and getString(int
stringLength). The getChar() function, for example, loops until the
length of socketBuffer is one. It then returns character received
though the socket connection. The getString function does the same
thing, but returns the value when the length equals the specified
length.
Anyway, when I call getChar and getString, the CPU peaks at 100% ? Is
there any better way to do this? Or any other way to wait until I
receive the data?
Please help, if you can.
Could someone please point me in the right direction? Here is my
problem. I have created a telnet server for a records management
system. To handle multi users, I made this server thread out each
connection. After threading the connection it threads out to handle the
user interaction. The connection thread is constantly reading data from
the socket and putting it into a variable contained into a class called
socketBuffer.
I have two functions to read data. They are getChar() and getString(int
stringLength). The getChar() function, for example, loops until the
length of socketBuffer is one. It then returns character received
though the socket connection. The getString function does the same
thing, but returns the value when the length equals the specified
length.
Anyway, when I call getChar and getString, the CPU peaks at 100% ? Is
there any better way to do this? Or any other way to wait until I
receive the data?
Please help, if you can.