Game Development Community

Need help with TCPObject.send()

by Skylar Kelty · in Torque Game Engine · 02/24/2008 (1:43 am) · 4 replies

Hey,

Im currently coding a login server for a game im working on, but i've run across a problem.
Everything seems to connect fine, but I cant .send() anything.
I did a brake-debug thing and found out that I get an unknown error in:
Net::Error Net::send(NetSocket socket, const U8 *buffer, S32 bufferSize)

The error is always the same as the buffer size, is that ok?

Anyway I still cant actually send any data so help would be appreciated.

Thanks,
James

EDIT: found out its sending, and receiving, but not processing properly, im sure I can fix it, please ignore this :)

EDIT: no i need your help :)

The problem is in:
void TCPObject::parseLine(U8 *buffer, U32 *start, U32 bufferLen)

There are so many
if(i != bufferLen)
that it never gets a chance to do anything!


Seems it will only process multiple lines, not a single line.


EDIT: sticking a "\n" on the end of everything i .send seems to work.
But im still not happy!
I think we should be able to send a single line!

#1
02/24/2008 (3:56 am)
You can send a single line like this: .send("This is a line\r\n")
The parseLine is very usefull thing, it makes sure you get each full line.
#2
02/24/2008 (5:26 am)
Do you need the \r?
#3
02/24/2008 (8:00 am)
Usually line based tcp protocols use CRLF (like pop3, smtp, irc, ....) while the TCPObject::parseLine also works without \r - it works with it.
#4
02/24/2008 (9:04 am)
Ah ok, thanks :)