tcppacket.cpp
Upload User: zslianheng
Upload Date: 2013-04-03
Package Size: 946k
Code Size: 1k
Development Platform:

Visual C++

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *   This program is free software; you can redistribute it and/or modify  *
  4.  *   it under the terms of the GNU General Public License as published by  *
  5.  *   the Free Software Foundation; either version 2 of the License, or     *
  6.  *   (at your option) any later version.                                   *
  7.  *                                                                         *
  8.  *   copyright            : (C) 2002 by Zhang Yong                         *
  9.  *   email                : z-yong163@163.com                              *
  10.  ***************************************************************************/
  11. #include "tcppacket.h"
  12. int TcpOutPacket::send(int sock)
  13. {
  14. uint16 len = cursor - data - sizeof(len);
  15. *((uint16 *) data) = htons(len);
  16. return ::send(sock, data, len + sizeof(len), 0);
  17. }