--- deliantra/server/socket/lowlevel.C 2006/12/14 00:01:37 1.12 +++ deliantra/server/socket/lowlevel.C 2006/12/14 01:12:35 1.13 @@ -120,7 +120,7 @@ va_list ap; va_start (ap, format); - len += vsprintf ((char *)buf + len, format, ap); + len += vsnprintf ((char *)buf + len, MAXSOCKBUF, format, ap); va_end (ap); } @@ -362,21 +362,32 @@ } } - /** * Takes a string of data, and writes it out to the socket. A very handy * shortcut function. */ + +void +NewSocket::send_packet (SockList &sl) +{ + Send_With_Handling (this, &sl); +} + void -cs_write_string (NewSocket *ns, const char *buf, int len) +NewSocket::send_packet (const char *buf, int len) { - SockList sl; + SockList sl (MAXSOCKBUF); - sl.len = len; - sl.buf = (unsigned char *) buf; - Send_With_Handling (ns, &sl); + sl << data (buf, len); + send_packet (sl); + sl.free (); } +void +NewSocket::send_packet (const char *buf) +{ + send_packet (buf, strlen (buf)); +} /** * Calls Write_To_Socket to send data to the client. @@ -407,21 +418,6 @@ Write_To_Socket (ns, (char *) msg->buf, msg->len); } -/** - * Takes a string of data, and writes it out to the socket. A very handy - * shortcut function. - */ -void -Write_String_To_Socket (NewSocket *ns, char *buf, int len) -{ - SockList sl; - - sl.len = len; - sl.buf = (unsigned char *) buf; - Send_With_Handling (ns, &sl); -} - - /****************************************************************************** * * statistics logging functions.