Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Linux Socket HTTPÇëÇóµÄÎÊÌ⣬¸ßÊÖ½ø£¡

СµÜ×î½üÐèÒªÒ»¸öÓÃsocket»ñÈ¡htmlÎĵµµÄ´úÂ룬µ«ÊÇÀÏÊDz»ÄÜ»ñÈ¡ÍêÕûµÄhtmlÔ´Âë¡£Ô­Òò²»Ã÷£¬Íû¸ßÊÖÖ¸µã£¡
C/C++ code:

char *Http_GET(char *host,int port,char *data) //·¢ËÍGETÇëÇó
{
char response[204800],http_request[2048],*ret; //½ÓÊÕÊý¾ÝµÄ»º³åÇø´óС200k ÇëÇóÄÚÈÝ»º³åÇø2k
struct hostent *get_ip_addr; //ÍøÂçµØÖ·µÄÊý¾Ý½á¹¹hostent
get_ip_addr = gethostbyname(host); //µ÷ÓÃgethostbyname»ñÈ¡Ö÷»úipµØÖ·£¬·ÅÈë½á¹¹Ìâget_ip_addr
struct sockaddr_in remote_host; //ÍøÂçsocket½á¹¹remote_host
remote_host.sin_family = AF_INET; //ʹÓÃTCP£¯IP
remote_host.sin_port = htons(port); //Ô¶³Ì¶Ë¿Ú
memcpy(&remote_host.sin_addr.s_addr,get_ip_addr->h_addr_list[0],sizeof(get_ip_addr->h_addr_list[0]));//»ñÈ¡Ò»¸öIP°ÑËû·ÅÈëremote_host.sin_addr.s_addrµÄÄÚ´æ¿Õ¼ä
int remote_std = socket(AF_INET,SOCK_STREAM,0); //´ò¿ªsocket£¬²¢¶¨ÒåÌ×½Ó×Öremote_std
connect(remote_std,(struct sockaddr*)&remote_host,sizeof(remote_host)); //Á¬½ÓÄ¿±êÖ÷»ú
memset(http_request,'\0',sizeof(http_request)); //½«ÇëÇóÄÚÈݵÄÄÚ´æ¿Õ¼äÖÿÕ
// sprintf(http_request,get_format,data); //дÈëhttpÇëÇóÄÚÈÝ
strcpy(http_request,"GET /FT_class.php?t_type=h2&id=361\r\nHost: 60.248.11.100\r\nConnection: Close\r\n\r\n");
send(remote_std,http_request,strlen(http_request),0); //·¢ËÍÇëÇó
recv(remote_std,response,sizeof(response),0); //½ÓÊÕ·µ»Ø£


Ïà¹ØÎÊ´ð£º

£ÛÇóÖú£ÝlinuxÍøÂç±à³ÌÖÐselect³ö´í

Ä¿±ê£ºµ±ÍøÂçÖÐÓÐÊý¾Ýµ½´ï»òÕß³¬Ê±£¬³ÌÐò½øÈëÏÂÒ»´ÎÑ­»·¡£
ÎÊÌ⣺select()º¯Êý²»Æð×÷Ó㬳ÌÐò²»»áÔÚselectµÄµØ·½×èÈûÒ»Ã룬²¢ÇÒµ±ÍøÂçÉÏÓÐÊý¾ÝµÄʱºò£¬selectµÄ·µ»ØÖµÈÔȻСÓÚ0
    #include <s ......

linux °²×°xinetdµÄÎÊÌâ

ÒòΪ°²×°cvsÒªÓõ½xinetd·þÎñ£¬·¢ÏÖ»úÆ÷ÉÏûÓС£¡£¾Í´ÓÍøÉÏÏÂÔØÁ˸ö×°ÉÏ£¬
SQL code:
[root@localhost ~]# rpm -qa xinetd
[root@localhost ~]# rpm -qa telnet
telnet-0.17-38.el5
[root@localhost ~]#
¸ ......

linux + oracleÓÃXP·ÃÎʲ»ÁË

ÎÒ°²×°Ò»Ì¨redhat linux5+oracle 10gµÄ·þÎñÆ÷£¬±Ê¼Ç±¾£¨XPϵͳ£©°²×°ÁËoracle 10g¿Í»§¶Ë,½á¹ûÀÏÊdzö12560µÄ´íÎó£¬Çë¸ßÊÖÖ¸µãÒ»¶þ£¬

-A RH-Firewall-1-INPUT -m state –state NEW -m tcp -p tcp –dpor ......

linux ºÍ windows Ïà±È °²È«ÐÔºÎÔÚ

  ÓÐÈËÈÏΪ£¬linux °²È«ÐԸߣ¬Ö»ÊÇÒòΪÓõÄÈËÉÙ£¬ËùÒÔÄÇЩºÚ¿Í²»Ô¸ÒâÈ¥¹¥»÷£¬ËùÒÔ²¡¶¾Ö®ÀàµÄ¾ÍÉÙ£¬ÊDz»ÊÇÕâÑù£¿¶øÇÒlinuxÊÇ¿ªÔ´µÄ£¬¹¥»÷ÆðÀ´ ±È½ÏÈÝÒ×ËùÒÔ ÀÁµÄÈ¥¹¥»÷
ÕâÖÖ˵·¨¶Ôô
linux Ôõô¾Í°²È«¸ß ......

¹ØÓÚLinuxϵͳµÄ-dfÖ¸Áî

ÓÃ-dfÖ¸Áîºó²éѯ³öÈçϽá¹û
/dev/hda2 1361587 1246406 44823 97£¥ / 
ÇëÎÊ£¬×îºóµÄ°Ù·Ö±ÈÖµÓ¦¸ÃÔÚ¶àÉÙ·¶Î§ÄÚ²ÅËãÕý³££¿
ÕâûÓÐÕý³£²»Õý³£Ò»Ëµ, ÏÔʾµÄÊÇÄãÓ²Å̵ÄʹÓÃÇé¿ö.
ÄãµÄ¸ù·ÖÇøÒѾ­Ê¹ÓÃÁË97% ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ