Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 C + + Training


Linux C + + Training
Syllabus
________________________________________
1, Linux Operating System
System Environment: Ubuntu GNU / Linux, RedHat Linux AS5,
FreeBSD
Course Requirements: proficient use of commonly used Linux
/ UNIX commands.
Time: 1 week.
______________________________ ......

SUSE Linux ά»¤±Ê¼ÇÒ»

SUSE Linux ά»¤±Ê¼Ç Ò»
1. Linuxʱ¼ä¸üÐÂÉèÖÃ
ʱÇøÉ趨:
#Ö÷ÒªÎļþ
/etc/sysconfig/clock
#Óñ±¾©Ê±¼äµÄÕýÈ·ÄÚÈÝÓ¦¸ÃÊÇ
TIMEZONE="Asia/Beijing"
DEFAULT_TIMEZONE="Asia/Beijing"
#ͬʱȷ±£ /etc/localtimeÎļþÊÇ/usr/share/zoneinfo/Asia/BeijingµÄ¿½±´
±£³Ö¸üÐÂ:
ÔÚ/etc/crontabÖмÓÈëÒ» ......

linux »ñÈ¡µ±Ç°³ÌÐò·¾¶

#include <stdio.h>
#include <unistd.h>
int main() {
char link[100], path[100];
sprintf(link, "/proc/%d/exe", getpid());
readlink(link, path, sizeof(path));
printf("%s\n.", path);
return 0;
} ......

½« 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ºÅ