• Welcome to Valhalla Legends Archive.
 

[c++] problem with sending data

Started by mentalCo., June 09, 2004, 11:18 PM

Previous topic - Next topic

UserLoser.

Quote from: mentalCo. on June 09, 2004, 11:18 PM
ok im connected and in a channel... when i send this exact packet: "FF 0E 09 41 41 41 41 41 00" nothing happens... theoretically it should send 5 'A's to the channel... am i doing this wrong?

Remember that Battle.net doesn't echo back your own chat messages, so you would have to display your name and your message without an event being triggered

mentalCo.

#16
ya...

my only problem now is that it takes the first 5 letters of whatever i send and replaces them with a question mark followed by the rest of the text.  has this happened to anyone?
edit

i fixed it heres my code


void SEND(char szText[500])
{

unsigned short PacketSize = strlen(sBuf);
szText[strlen(sBuf)]='\n';
unsigned char szBuffer[MAXSIZE] = ""; // initialize a canned buffer (unsigned char since we're dealing with >127 ascii character values)
szBuffer[0] = 0xFF; // insert magic&packetID
szBuffer[1] = 0x0E;
*(unsigned short *)(szBuffer + 2) = PacketSize; // insert packet size (ushort) starting at buffer[2]
sprintf((char *)szBuffer + 3, szText); // copy the string onto the end of the buffer (just past the header)
if((send(sockfd, (char *)szBuffer, PacketSize+5, 0))==-1){cout<<"ERRRRRRRROOOOR\n\nasdfasdfasd";}

}