c±à³Ì ͨѶÐÒéhttp
Îʸö±È½ÏÈõµÄÎÊÌâ¡£
ÓÃc¿ª·¢£¬·þÎñÆ÷ºÍ¿Í»§¶ËµÄ³ÌÐò£¬Í¨Ñ¶ÐÒéÓÃhttp¡£
²»ÖªµÀÔõôÈëÊÖÁË£¬ÊDz»ÊÇsocket±à³Ì£¿»¹ÊÇÓ¦¸Ã¿´ÄÄЩ·½ÃæµÄ¼¼Êõ
ÓÐÏֳɵÄhttp¿â ÄÃÀ´ÓÃ
×Ô¼ºÐ´socketÂé·³ËÀÁË
ÍøÉÏÕÒµã´úÂ룡 ×Ô¼ºÐ´ÄÜ·³ËÀ£¡
ллÁË
ÏÖÔÚÓÐÄÄЩhttp¿â£¬±È½Ï³£Óõģ¿
¶¥Ò»Ï£¡
C/C++ code:
#include<iostream>
#include<map>
#include<stdlib.h>
#include<signal.h>
#include<errno.h>
#include<unistd.h>
#include<string.h>
#include<sys/resource.h>
#include<sys/stat.h>
#include<sys/types.h>
#include<fcntl.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<sys/socket.h>
#define PORT 80
#define BUFSIZE 8196
#define LISTENQ 64 //
using namespace std;
struct client_t{
int fd;
int state;
unsigned int pois;
string ip;
string read_buf;
string write_buf;
//http request
string method_req;
string url;
string http_v;
string host;
client_t(){
fd=0;
state=0;//¶Áд״̬£¬0-¶Á£¬1-д
pois=0;
ip.clear();
read_buf.reserve(BUFSIZE);
write_buf.reserve(BUFSIZE);
method_req.clear();
Ïà¹ØÎÊ´ð£º
ΪʲôCдµÄDLLÎļþC¡¢PBÄܵ÷ÓÃVB²»Äܵ÷Óã¿
VBÀïΪʲôÓеÄDLLÖ±½Óͨ¹ýÒýÓÿÉÒÔʹÓã¿ÓеÄÐèҪͨ¹ýdeclareÉêÃ÷Íⲿº¯Êý£¿ÕâЩDLLÓÐʲô²î±ð£¿
1¡¢ÎªÊ²Ã´PBÄÜͨ¹ýDECLAREÉùÃ÷¶øVB²»ÐУ¿
2¡¢Èç¹ûÕâ¸ödllÖÐµÄ ......
ÎÒÓÃPHPÀ©Õ¹Cʱ£¬ÓõÄÊÇÔ´ÂëextĿ¼ÏµÄ./ext_skel
×îºó±àÒë×ÜÊDz»ÄÜÉú³ÉÀ©Õ¹Ä£¿éµÄ.so¶¯Ì¬¿â£¬ÎÒÓõİ汾ÊÇ5.3.0£¬
ÕâÊÇÔõô»ØÊ£¬¸ßÊÖ½â´ðÏÂ
²»ÄÜÉú³ÉʱÓÐɶÌáʾÐÅÏ¢£¿
ÔËÐÐÁË/ext_skel --extname=Ä ......
±àд³ÌÐòdetab, ½«ÊäÈëÖеÄÖÆ±í·ûÌæ»»³ÉÊʵ±ÊýÄ¿µÄ¿Õ¸ñ£¬Ê¹¿Õ¸ñ³äÂúµ½ÏÂÒ»¸öÖÆ±í·ûÖÕÖ¹µÄµØ·½¡£¼ÙÉèÖÆ±í·ûÖÕֹλµÄλÖÃÊǹ̶¨µÄ£¬±ÈÈçÿ¸ônÁоͻá³öÏÖÒ»¸öÖÆ±í·ûÖÕֹλ¡£
£££££££££££££££££££ ......
ÏëÖªµÀÿÌõÖ¸Áî»òº¯ÊýµÄϵͳÏûºÄ¡£±ÈÈçϵͳִÐÐint a=0£»µÄ¿ªÏúÊǶàÉÙ¡£ÓÐûÓÐÀàËÆµÄÎĵµÖ®ÀàµÄ¡£²»ÒªºÍÎÒ˵ÓÃʲôclock()º¯ÊýÀ´²âÊÔ¡£ÎÒÏëÒªÏà¹Ø×ܽáºÃµÄÎĵµ
ÏÈ·´»ã±à,È»ºóÄÃ×ÅcpuµÄÖ¸ÁîÊÖ²á²éÿÌõÖ¸ÁîµÄʱ¼äÖÜÆÚ ......
ÎÊһϣº
#include <stdio.h>
int main()
{
char x, y, z;
int i;
int a[16];
for(i=0; i<=16; i++)
{
a[i] = 0;
......