00001 /*00002 Copyright (C) 2001 Nate Miller nkmiller@calpoly.edu00003
00004 This program is free software; you can redistribute it and/or00005 modify it under the terms of the GNU General Public License00006 as published by the Free Software Foundation; either version 200007 of the License, or (at your option) any later version.00008
00009 This program is distributed in the hope that it will be useful,00010 but WITHOUT ANY WARRANTY; without even the implied warranty of00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the00012 GNU General Public License for more details.00013
00014 You should have received a copy of the GNU General Public License00015 along with this program; if not, write to the Free Software00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.00017
00018 See gpl.txt for more information regarding the GNU General Public License.00019 */00020 #ifndef __CLIENTH__00021 #define __CLIENTH__00022
00023 // I #define all of these since I have no idea if they will be there on00024 // non-Win32 platforms. They were taken from winsock.h.00025 #ifndef socket_t00026typedefunsignedintsocket_t;
00027 #endif00028
00029 #ifndef INVALID_SOCKET00030#define INVALID_SOCKET (~0)00031 #endif00032
00033 #ifndef INADDR_NONE00034#define INADDR_NONE (~0)00035 #endif00036
00037 #ifndef SOCKET_ERROR00038#define SOCKET_ERROR -100039 #endif00040
00041 // see TCPClient.cpp for info00042struct TCPClient_t00043 {
00044TCPClient_t() {sock =(unsigned int)INVALID_SOCKET;}
00045virtual~TCPClient_t() {Disconnect();}
00046
00047boolIsConnected() {returnsock != INVALID_SOCKET;}
00048
00049 boolConnect(constchar *host, unsignedshort port);
00050 voidDisconnect();
00051 boolSend(char *fmt, ...);
00052 intRead(char *dest, int &len);
00053 boolCanRead();
00054
00055 protected:
00056staticconstintdataBuffSize;
00057socket_tsock;
00058 };
00059
00060
00062 // Ãß°¡. 00064 #include "dataBuff.h"00065class NetworkFile00066 {
00067 public:
00068 #ifdef _DEBUG00069 bool bloaded;
00070 #endif00071dataBuff_tdata;
00072TCPClient_tclient;
00073char* netData;
00074intsize;
00075intsize_of_file;
00076 NetworkFile(constchar* server_name, constchar *name);
00077 ~NetworkFile();
00078
00079 // http 1.0 Çì´õ ºÎºÐÀ» Á¦¿ÜÇÑ ºÎºÐ¸¸ µ¥ÀÌŸ·Î ÀúÀå.00080voidOmmitHeader(unsignedchar* pData)
00081 {
00082 char* ppData = strstr((constchar*)pData,"Content-Length: ");
00083 if(ppData)
00084 size_of_file = atoi(ppData+strlen("Content-Length: "));
00085 // strstr((const char*)ppData,'00086 /* Parser::StartParseBuffer((const unsigned char*)pData,1024);00087 while(Parser::GetToken(true))00088 {00089 if(strnicmp(Parser::token,"Content",7)==0)00090 break;00091 }00092 */00093 }
00094 };
00095
00096
00097
00098 #endif00099
00100
00101
00102
Copyright(C) gvSystem & GamePlus All Rights Reserved.