Hey everyone i'm having a socket issue, i'm making a chat client for linux as they dont have one yet and i hate using the java client on the website, anyway, i'm trying to receive protocols from the server and it wont let me, telnet confirms that the server is fine as i can login via telnet easily. My socket apparently isn't processing them properly i think each protocol ends with the line feed "\n" in gambas, so i have to basically collect all the protocols i get and put them all into one big buffer string and parse through it and remove protocols as i process them. also the chat server will send one protocol over multiple packets sometimes so relying on the packets isn't an option. Below is the code i'm using in my Socket_Read() event:
PUBLIC SUB sckData_Read()
DIM newcom AS String
DIM i AS Integer
DIM Data AS String
READ #sckData, Data, Lof(sckData)
WSBuffer = WSBuffer & Data
WHILE InStr(WSBuffer, "\n") > 0
i = InStr(WSBuffer, "\n")
newcom = Left(WSBuffer, i - 1)
WSBuffer = Mid(WSBuffer, i + 1)
ModProtocolHandler.ProcessData(newcom)
WEND
END
If anyone has any clues as to why this happens i'd really appreciate some input on this, i'm stumped.
Edit: Nevermind, i misread the documentation wrong and used Write instead of Print.