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

linux epollÓÃÓÚsocket¿ØÖÆ ´úÂëʵÀý

¹ØÓÚepollʹÓ÷½·¨£º
²ÎÕÕ£º  http://linux.die.net/man/4/epoll
ʵÀý´úÂ룺£¨À´×ÔÍøÉÏijÂÛ̳£©
#include <pthread.h>
#include <stdio.h>
#include <sys/timeb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h>
#include <errno.h>
#define MAX_CLIENT 101
#define PORT 3355
#define DEBUG
int listenfd;
//ÉèÖÃsocketÁ¬½ÓΪ·Ç×èÈûģʽ
void nonblock(int sockfd)
{
    int opts;
    opts = fcntl(sockfd, F_GETFL);
    if(opts < 0)
    {
        perror("fcntl(F_GETFL)\n");
        exit(1);
    }
    opts = (opts | O_NONBLOCK);
    if(fcntl(sockfd, F_SETFL, opts) < 0)
    {
        perror("fcntl(F_SETFL)\n");
        exit(1);
    }
}
int main()
{
    int epfd;
    struct epoll_event *events;
    struct epoll_event ev;
   
    struct sockaddr_in srv;
    int clifd;
    int i;
    int n;
    int res;
    char buffer[1024];
    //´´½¨·þÎñÆ÷¶Ësocket
    if( (listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
    {
        perror("sockfd\n");
        exit(1);
    }
    bzero(&srv, sizeof(srv));
    srv.sin_family = AF_INET;
    srv.sin_addr.s_addr = htonl(INADDR_ANY);;
    srv.sin_port = htons(PORT);
    //·


Ïà¹ØÎĵµ£º

LinuxÉ豸ģÐÍÖ®input×ÓϵͳÏê½â

Ò»£ºÇ°ÑÔ
×î½üÔÚÑо¿androidµÄsensor driver£¬Ö÷ÒªÊÇE-compass£¬ÆäÖÐÓõ½ÁËLinux input×Óϵͳ.ÔÚÍøÉÏÒ²¿´Á˺ܶàÕâ·½ÃæµÄ×ÊÁÏ£¬¸Ð¾õ»¹ÊÇÕâƪ·ÖÎöµÄ±È½ÏϸÖÂ͸³¹£¬Òò´ËתÔØÒ»ÏÂÒÔ±ã×Ô¼ºÑ§Ï°£¬Í¬Ê±ºÍ´ó¼Ò·ÖÏí£¡
£¨Õâƪ²©¿ÍÖ÷ÒªÊÇÒÔ¼üÅÌÇý¶¯ÎªÀýµÄ£¬²»¹ý½²½âµÄÊÇLinux Input Subsystem£¬¿ÉÒÔ×ÐϸµÄÑо¿Ò»Ï£¡£©
¼üÅÌÇý¶¯½«¼ì ......

linux¶àÏß³ÌÉè¼Æ(zz)

linux¶àÏß³ÌÉè¼Æ
¡¡¡¡1 ÒýÑÔ
¡¡¡¡Ị̈߳¨thread£©¼¼ÊõÔçÔÚ60Äê´ú¾Í±»Ìá³ö£¬µ«ÕæÕýÓ¦ÓöàÏ̵߳½²Ù×÷ϵͳÖÐÈ¥£¬ÊÇÔÚ80Äê´úÖÐÆÚ£¬solarisÊÇÕâ·½ÃæµÄٮٮÕß¡£´«Í³µÄUnixÒ²Ö§³ÖÏ̵߳ĸÅÄµ«ÊÇÔÚÒ»¸ö½ø³Ì£¨process£©ÖÐÖ»ÔÊÐíÓÐÒ»¸öỊ̈߳¬ÕâÑù¶àÏ߳̾ÍÒâζ×Ŷà½ø³Ì¡£ÏÖÔÚ£¬¶àÏ̼߳¼ÊõÒѾ­±»Ðí¶à²Ù×÷ϵͳËùÖ§³Ö£¬°üÀ¨Windows/NT£ ......

¸ü¸ÄlinuxĿ¼µÄĬÈÏÑÕÉ«£¨ÎÒÑ¡ÔñÁËYellow£©

ÔÚ¿ØÖÆ̨Ï£¬ÓÃls£¬¾Í»á·¢ÏÖ£¬shell½«²»Í¬ÀàÐ͵ÄÎļþÏîÄ¿ÏÔʾΪ²»Í¬µÄÑÕÉ«¡£Õß¿ÉÒÔÌá¸ßЧÂÊ£¬²»ÓÃls -l±ãÄÜ´ó¸ÅµÄ°Ñ¸÷¸öÎļþµÄÀàÐÍÇé¿öÁ˽âһϡ£
ÄãÓÐûÓÐÏë¹ý¸ü¸ÄÕâ¸ö×ÅÉ«ÅäÖÃÄØ£¿
Æä
ʵ£¬ÔÚ/etcÏÂÓÐÒ»¸öDIR_COLORSµÄÎļþ£¬ÕâÊÇÒ»¸ö×ÅÉ«¿ØÖƵÄÄ£°æ¡£ÏÖ½«Õâ¸öÄ£°æ¿½³öÀ´¡£Èç¹ûÏëÈÃÕâ¸öÅäÖÃÔÚrootÓû§ÏÂÉúЧ£¬±ß¿½µ½
......

Unix/Linux ϵͳ×Ô¶¯»¯¹ÜÀí: ÄÚ´æ¹ÜÀíƪ

2009 Äê 10 ÔÂ 29 ÈÕ
±¾ÎÄÊÇ Unix/Linux ϵͳ¹ÜÀí×Ô¶¯»¯ÏµÁÐÖеÄһƪÎÄÕ£¬Ö÷Òª½éÉÜÁËÄÚ´æ¹ÜÀíËùÉæ¼°µÄÃüÁ²¢Í¨¹ý±àд×Ô¶¯»¯½Å±¾ÊµÏÖÁËÄÚ´æ¹ÜÀíÓë¼à¿ØµÄ×Ô¶¯»¯
ÄÚ´æÊÇ Unix/Linux ÄÚºËËù¹ÜÀíµÄ×îΪÖØÒªµÄ×ÊÔ´Ö®Ò»£¬ÄÚ´æ¹ÜÀíÊÇϵͳ¹ÜÀíÖзdz£ÖØÒªÒ²ÊÇ×ÔӵĵIJ¿·Ö¡£ÏµÍ³¹ÜÀíÔ±ÐèÒªÕÆÎÕÄÚ´æ¹ÜÀíµÄ»ù±¾¹¤×÷Ô­ÀíÒÔ¼°Ê¹Óú ......

½« Linux Ó¦ÓóÌÐòÒÆÖ²µ½ 64 λϵͳÉÏ


ƽ»¬Ç¨ÒƵļ¼Çɺͼ¼Êõ
ÎĵµÑ¡Ïî
<tr
valign="top"><td width="8"><img alt="" height="1" width="8"
src="//www.ibm.com/i/c.gif"/></td><td width="16"><img alt="" width="16"
heig ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ