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

linuxÏÂIP v6 tcp·þÎñÆ÷¶ËÔ´ÂëʾÀý

/******************************
*
* server.c
*
******************************/
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<errno.h>
#include<string.h>
#include<netinet/in.h>
#include<sys/wait.h>
#include<unistd.h>
#include<arpa/inet.h>
#include<pthread.h>


#define MAXBUF 1024
#define LISNUM 10
#define DEFULT_PORT 8787

void *connect_to_client(void *data);
struct sockaddr_in6 serv_addr,client_addr;
/**************************/
int main(int argc,char *argv[])
{
int sockfd,new_fd;
unsigned int serv_port;
unsigned int lisnum;
char buf[MAXBUF+1];

printf( "the command is %s [port] [listen_num]\n", argv[0] );

// ¼àÌýÆðʼ¶Ë¿Ú
if ( argv[1] != NULL )
{
serv_port = atoi( argv[1] );
}
else
{
serv_port = DEFULT_PORT;
}
// ¼àÌý¶Ë¿Ú¸öÊý
if ( argv[2] != NULL )
{
lisnum = atoi(argv[2]);
}
else
{
lisnum = LISNUM;
}

// ´´½¨socket
if ( (sockfd = socket(PF_INET6,SOCK_STREAM,0)) < 0 )
{
perror("creat socket");
exit(1);
}

// ÅäÖ÷þÎñÆ÷µØÖ·Óë¶Ë¿Ú
bzero(&serv_addr, sizeof(serv_addr));
serv_addr.sin6_family = AF_INET6;
serv_addr.sin6_port = htons(serv_port);
serv_addr.sin6_addr = in6addr_any;
// µØÖ·°ó¶¨²Ù×÷
if ( bind(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr) ) <0 )
{
perror("bind");
exit(1);
}

// ·þÎñÆ÷¼àÌý
if ( listen(sockfd, lisnum) < 0 )
{
perror("listen");
exit(1);
}

while(1)
{
int len = sizeof(struct


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

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

ʵսLinux Bluetooth±à³Ì (Æß) SDPЭÒé

Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖЭÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀЭÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......

Linux²é¿´Îļþ¼Ð´óСµÄÃüÁî

[root@ns1 opt]#  du -h -s /* | sort
12K     /mnt
13M     /sbin
16K     /lost+found
1.8G    /usr
194M    /root
22G     /opt
24K     /tmp
4.0K&n ......

linuxÏÂtcp·þÎñÆ÷Ô´ÂëʾÀý

#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <string.h>
#include <netinet/in.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <s ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ