Linux TCP Socket³ÌÐò·ÖÎö
/************************
cÓïÑÔ±àдµÄtcp socketͨÐŵÄserver¶Ë¡£
¿ÉÒÔ³ÖÐø¼àÌýmyprotÖ¸¶¨µÄ¶Ë¿Ú
´òÓ¡¶Ë¿Ú½ÓÊÕµ½µÄ×Ö·ûÁ÷
Í·ÎļþÒòΪ¼âÀ¨ºÅ±»×ªÒ壬ËùÒÔÓÃÁËÒýºÅ
************************/
#include "stdio.h"
#include "stdlib.h"
#include "errno.h"
#include "string.h"
#include "sys/types.h"
#include "netinet/in.h"
#include "sys/socket.h"
#include "sys/wait.h"
int main(int argc,char **argv)
{
int sockfd, new_fd;
struct sockaddr_in my_addr;
struct sockaddr_in their_addr;
unsigned int sin_size,myport,listnum;
myport = 9785; //°ó¶¨µÄ¶Ë¿ÚºÅ
listnum = 10;
/*************************************************
Socket½Ó¿Ú£ºÊÇTCP/IPÍøÂçµÄAPI£¬Socket½Ó¿Ú¶¨ÒåÁËÐí¶àµÄº¯Êý£¬¿ÉÒÔ
ÔÚ´Ë»ù´¡ÉÏ¿ª·¢InternetÉϵÄTCP/IPÍøÂç±à³Ì
Create Socket: int socket(int domain, int type, int protoco);
Argument Description:domain Ö¸Ã÷ËùÓÐÐÒé×壬ͨ³£ÊÇPF_INET(TCP/IPV4)
µ±È»ËûÒ²¿ÉÒÔÖ§³ÖIPV6£¬ºÍ¸ü¶àµÄÍøÂçÐÒ飬¸ù¾Ý
¾ßÌåµÄÓ¦ÓÃÀ´Ñ¡Ôñ
type ·ÖSOCK_STREAM(TCP),SOCK_DGRAM(UDP),SOCK_RAW
Ïà¹ØÎĵµ£º
´´½¨×ÀÃæͼ±ê
Ä¿Ç°½«ÍøÂçÓ¦ÓÃÀ©Õ¹µ½×ÀÃæÊÇÒ»¸öÇ÷ÊÆ£¬´æÔÚןܶà½â¾ö·½°¸£¬±¾ÎÄÒÔ Mozilla Prism ΪÀý£¬ÀàËƵķ½·¨Í¬ÑùÊÊÓÃÓÚ Google Chrome ¡£
1. µ½ Mozilla Prism µÄÍøÕ¾ÉÏÏÂÔØ Prism£¬µã»÷ Download Now Ö®ºó»áÌáʾÓÐÁ½ÖÖ£¬Ò»ÖÖÊÇÒÔ Mozilla Firefox À©Õ¹µÄ·½Ê½£¬ÊʺÏÒѾ°²×°ÓÐ Firefox µÄÅóÓÑ£»Ò»Ö ......
×ÜÀÀ
ÓÃiptables -ADC À´Ö¸¶¨Á´µÄ¹æ
Ôò
£¬-AÌí¼Ó -Dɾ³ý -C ÐÞ¸Ä
iptables - [RI] chain rule num rule-specification[option]
ÓÃiptables - RI ͨ¹ý¹æÔòµÄ˳ÐòÖ¸¶¨
iptables -D chain rule num[option]
ɾ³ýÖ¸¶¨¹æÔò
iptables -[LFZ] [chain][option]
ÓÃiptables -LFZ Á´Ãû [Ñ¡Ïî]
iptables -[NX] chain
ÓÃ -NX ......
linuxÄÚºËʵÏÖÁËcrypto½Ó¿Ú£¬ÓÃÓÚÀàËÆIPSecÖ®ÀàÒªÔÚÄÚºËÖÐʵÏÖµÄÓë²Ù×÷ϵͳ°ó¶¨µÄ°²È«»úÖÆ£¬Èç¹û²»ÊÇÓÃÓÚÕâÑùµÄ»úÖÆ£¬²»ÒªÊ¹ÓÃÄÚºËÖеÄcrypto½Ó¿Ú£¬×ܵÄÀ´Ëµ£¬linuxµÄcryptoÖÐ×îÖØÒªµÄ½á¹¹ÌåÓÐÁ½¸ö£ºcrypto_tfmºÍcrypto_alg
struct crypto_tfm {
u32 crt_flags;
union {
& ......
½ñÌìºÜ¹û¶ÏµÄ°ÑÒ»Ö±ÔÚÐéÄâ»úÉÏ°²×°µÄLinuxжÔØÁË£¬¸Ð¾õÊÔÁËһС¶Îʱ¼äÔÚVMwareÉÏÃæ°²×°µÄLinux£¬Ê¹²»³ö¸Ð¾õÀ´¡£¸üΪÖØÒªµÄÊǾÝ˵£¨ÎÒÒ²Ö»ÄܵÀÌý;˵ÁË£©java³ÌÐò¿ª·¢ºÜ¶àÊÇÔÚLinux»·¾³Ï¿ª·¢µÄ£¨ÄѵÀÊÇÒòΪÔÚLinuxÏÂÔËÐУ¿£©¡£ÎªÁ˸ü¼ÓµÄ½Ó½üÉú²ú£¬ÎÒ¾ö¶¨°²×°Ë«ÏµÍ³¡£
&n ......
Ïà¹Øº¯Êý
fork£¬execve£¬waitpid£¬popen
±íÍ·Îļþ
££i nclude<stdlib.h>
¶¨Ò庯Êý
int system(const char * string);
º¯Êý˵Ã÷
system()
»áµ÷ÓÃfork()²úÉú×Ó½ø³Ì£¬ÓÉ×Ó½ø³ÌÀ´µ÷ÓÃ/bin/sh-c
stringÀ´Ö´ÐвÎÊýstring×Ö·û´®Ëù´ú±íµÄÃüÁ´ËÃü>ÁîÖ´ÐÐÍêºóËæ¼´·µ»ØÔµ÷ÓõĽø³Ì¡£ÔÚµ÷ÓÃsystem()ÆÚ¼äSIGCHLD ......