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

linux socket Ïê½â

Í·Îļþ£ºsys/socket.h
Ïà¹Ø½á¹¹Ì壺
struct sockaddr
{
    unsigned short sa_family;   //µØÖ·×å
    char sa_data[14];   //14×Ö½ÚЭÒ鵨ַ
};
struct sockaddr_in
{
    short int sin_family;   //µØÖ·×å
    unsigned short int sin_port;   //¶Ë¿ÚºÅ
    struct in_addr sin_addr;   //IPµØÖ·
    unsigned char sin_zero[8];   //Ìî³ä0ÒÔ±£³ÖÓëstruct sockaddrͬÑù´óС
};
struct in_addr
 {
   unsigned long s_addr; // that’s a 32-bit long, or 4 bytes
};
×¢£ºÕâÁ½¸öµØÖ·ÀàÐͽṹÌåÔÚÍ·ÎļþÖж¨Òå¡£
Ïà¹Øº¯Êý£º
<´ò¿ªÌ×½Ó×Ö>
int socket(int af,int type,int protocol);   //·µ»ØsocketÌ×½Ó×Ö£¬ÔÚºóÃæµÄµ÷ÓÃʹÓÃËü¡£
afÖ¸¶¨Í¨ÐÅ·¢ÉúÇøÓò£¨µØÖ·×壩
UNIXϵͳÓУºAF_UNIX,AF_INET,AF_NSµÈ¡£
DOS¡¢WINDOWSÖÐÖ§³Ö£ºAF_INET£¨Íø¼ÊÍøÇøÓò£©
×¢£ºµØÖ·×åÓëЭÒé×åÏàͬ¡£
typeΪSOCK_STREAM£¨½¨Á¢TCP/IPÁ¬½ÓµÄÁ÷ʽÌ×½Ó×Ö£©»òSOCK_DGRAM£¨½¨Á¢ÎÞÁ¬½ÓµÄUDPÊý¾Ý±¨Ì×½Ó×Ö£©
×¢£º½øÐÐÊý¾Ý±¨·½Ê½µÄÊý¾Ý´«Êäsendto()ºÍrecvfrom()ʱҪÓÃSOCK_DGRAM ²»È»»á²úÉú´íÎó¡£
protocolͨ³£Îª0
<Ö¸¶¨±¾µØµØÖ·>
int bind(int sockfd,struct sockaddr *my_addr,int addrlen);
sockfdΪsocket·µ»ØµÄÌ×½Ó×Ö¡£
my_addrÖ¸Ïò°üº¬±¾»úIPµØÖ·ºÍ¶Ë¿ÚºÅµÈÐÅÏ¢µÄsockaddrÀàÐÍÖ¸Õë¡£
addrlenͨ³£Îªsizeof(struct sockaddr)
×¢£º¶¨Òå±¾»úµØÖ·Í¨³£Îª
struct sockaddr_in my_addr;
... ...
my_addr.sin_family=AF_INET; 
my_addr.sin_port=htons(Ö¸¶¨¶Ë¿ÚºÅ);    //htons()½øÐÐ×Ö½Ú˳Ðòת»»£¬×ª»»³ÉÍøÂç×Ö½ÚÓÅÏÈ˳Ðò¡£
my_addr.sin_addr.s_addr=INADDR_ANY;   //INADDR_ANY×Ô¶¯»ñÈ¡±¾»úIPµØÖ·
<¼àÌýÇëÇó>
int listen(int sockfd,int backlog);
backlogÖ¸¶¨ÔÚÇëÇó¶ÓÁÐÖÐÔÊÐíµÄ×î´óÇëÇóÊý£¬½øÈë¶ÓÁеÄÇëÇ󽫵ȴýaccept()ËüÃÇ¡£
×¢£º·þÎñÆ÷³ÌÐòµÄͨ³£Ö´ÐÐ˳ÐòΪ sockfd=socket( ... ... );   bind(sockfd, ..., ...);   listen(sockfd, ..., ...);
       ÓÃSOCK_STREAMģʽÐèÒª accept()Á¬½ÓÇëÇó¡£
<½ÓÊÜÁ¬½ÓÇëÇó>
int accept(int sockfd,st


Ïà¹ØÎĵµ£º

BusyBox ¼ò»¯Ç¶Èëʽ Linux ϵͳ

http://www.ibm.com/developerworks/cn/linux/l-busybox/
BusyBox ¼ò»¯Ç¶Èëʽ Linux ϵͳ
ΪС»·¾³×¼±¸µÄÒ»¸öС¹¤¾ß°ü
ÎĵµÑ¡Ïî
<tr valign="top"><td width="8"><img alt="" height="1" width="8" src="//www.ibm.com/i/c.gif"/></ ......

Linux ·ÃÎÊfat¸ñʽÎļþϵͳ

Ê×ÏÈÒªµ¼ÈëÕâЩͷÎļþ
#include
#include
#include
#include
#include
#include



È»ºó¿´Ò»ÏÂʵ¼ÊµÄ²Ù×÷


1¡¢²é¿´ÎļþϵͳÐÅÏ¢
asmlinkage long get_files_info(char * filesystem_type)//È¡µÃµ±Ç°Ä¿Â¼µÄÎļþϵͳÐÅÏ¢
{
struct fs_struct *fs ;
struct vfsmount *mnt ;
......

linux ÏûÏ¢¶ÓÁÐʹÓþ­Ñé

¸ÅÊö£º
ÏûÏ¢¶ÓÁÐÊÇlinuxϽø³Ì¼äͨÐŵÄÒ»ÖÖ·½Ê½£¬Ò»°ãÓÃÓÚ´«ËÍÉÙÁ¿Êý¾Ý£¬Èç¹û´óÁ¿Êý¾ÝÐèÒªÔÚ½ø³Ì¼ä¹²Ïí£¬Ôò¿ÉÒÔÓù²ÏíÄÚ´æ¡£
º¯Êý½Ó¿ÚʹÓãº
linuxÏÂÌṩÁËÒÔϼ¸¸ö½Ó¿Ú£¬ÓÃÓÚÏûÏ¢¶ÓÁеÄʹÓã¬Ê¹ÓÃÒ»°ã¹ý³ÌÈçÏ£º
1. µ÷ÓÃftok½Ó¿Ú²úÉúÒ»¸ökey.
    ʹÓÃftokµÄºÃ´¦ÊÇ£¬·ÃÎÊͬһ¸öÏûÏ¢¶ÓÁеIJ»Í¬½ø³Ì¿ÉÒÔ ......

¡¾Nutch¡¿LinuxÏÂÓ¦ÓÃnutch 1.0 Webǰ¶ËʵÏÖµ¥»ú¼ìË÷

nutchµÄÅÀ³æºÍËÑË÷¿ÉÒÔ˵ÊÇ·ÖÀëµÄÁ½¿é£¬ÅÀ³æ¿ÉÒÔÊÇM/R×÷Òµ£¬µ«ËÑË÷²»ÊÇM/R×÷Òµ¡£ËÑË÷ÓÐÁ½ÖÖ·½Ê½£ºÒ»Êǽ«ÅÀ³æÊý¾Ý(»òÕß³ÆË÷ÒýÊý¾Ý)·ÅÔÚ±¾µØÓ²ÅÌ£¬½øÐÐËÑË÷¡£¶þÊÇÖ±½ÓËÑË÷HDFSÖеÄÅÀ³æÊý¾Ý¡£
ÕâÀï½éÉÜÈçºÎʹÓÃnutch-1.0µÄWEBǰ¶Ë¼ìË÷±¾µØÅÀ³æÊý¾Ý£º
(1)NutchµÄËÑË÷¿ÉÒÔ¶ÀÁ¢ÓÚhadoop¼¯Èº£¬Ö»Òª½«ÅÀ³æÏÂÀ´µÄÊý¾Ýcopyµ½ÈκλúÆ ......

GNU/Linux ¿ª·¢»·¾³ £¨1£©

¼¸ÖÜÒÔǰ£¬ÎÞÒâÖп´ÁËÎÒ¿ª·¢Linux·þÎñ³ÌÐòµÄ¹¤×÷»·¾³´îÅäÕâÆªÎÄÕ£¬È̲»×¡ÅÄÁËש£¬½á¹û×÷ÕßÔڻظ´Öм¤ÎÒ£¬ÒªÎÒд¸ö¿´¿´¡£Æäʵ¿´²»¹ßºÜ¶àÈËÎ§ÈÆM$µÄϰ¹ß£¬ÔçÒÑÓÐдµãʲôµÄÏë·¨£¬¿ÉÊÇûʲôʱ¼ä£¬Ò²µ£ÐIJ»Í¬µÄÏë·¨ºÍ×Ô¼ºÍ˲½Á˺ܶàµÄÖÐÎÄ»áÃÔ»óÓÐLinuxѧϰÈÈÇéµÄͬÐУ¬¸ü²»ÓÃ˵û׼»¹»áÏÅÅܱðÈË¡£ÎªÁ˱íʾÎÒÊÇ´ÓÀ´²»³Ô¼¤½«·¨ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ