Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌá¹©ÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

linuxϳ¬ÐÇÔĶÁÆ÷µÄ°²×°

1.A. extract the install file
    tar zxvf bxviewer.tar.gz
    cd bxviewer
    ./installbxv   
    logout
 1.B. if system can't find bxv after ur installation, you can always set
    it up by hand
......

linux C ¶ÁȡĿ¼Îļþ²¢Í³¼ÆÎļþÊý

#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
#include <string.h>
#define MAX 1024
int get_file_count(char *root)
{
 DIR *dir;
 struct dirent * ptr;
 int total = 0;
 char path[MAX];
 dir = opendir(root ......

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;
} ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ