示例#1
0
文件: xetp.cpp 项目: toppk/xevil
void XETP::send_message(OutStreamP out,char *msg) {
  assert(msg);
  u_int len = strlen(msg);
  
  if (out->get_protocol() == GenericStream::UDP) {
    ((UDPOutStreamP)out)->prepare_packet(XETP::add_header(len));
  }

  send_header(out,MESSAGE,len);
  // signed/unsigned shouldn't matter here, ASCII only.
  out->write((u_char *)msg,len);
  
  if (out->get_protocol() == GenericStream::UDP) {
    ((UDPOutStreamP)out)->done_packet();
  }
}
示例#2
0
文件: xetp.cpp 项目: toppk/xevil
void XETP::send_arena_message(OutStreamP out,int time,char *msg) {
  assert(msg);
  u_int len = sizeof(int) +  // time
    strlen(msg);             // string body
  
  if (out->get_protocol() == GenericStream::UDP) {
    ((UDPOutStreamP)out)->prepare_packet(XETP::add_header(len));
  }

  send_header(out,ARENA_MESSAGE,len);
  out->write_int(time);
  // signed/unsigned shouldn't matter here.
  out->write(msg,len - sizeof(int));
  
  if (out->get_protocol() == GenericStream::UDP) {
    ((UDPOutStreamP)out)->done_packet();
  }
}