linuxÏÂudp·þÎñÆ÷¶ËÔ´ÂëʾÀý
#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 <sys/socket.h>
int main(int argc, char **argv)
{
printf("server ip: %s\n", argv[1]);
printf("server port: %s\n", argv[2]);
printf("\n service starting...\n\n");
int socketFd;
struct sockaddr_in svrAddr;
struct sockaddr_in localAddr;
socketFd = socket (AF_INET, SOCK_DGRAM, 0);
if ( -1 == socketFd )
{
perror( "socket:" );
exit(-1);
}
// ÉèÖõØÖ·¿É¸´ÓÃ
int option = 1;
setsockopt( socketFd, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option) );
// ¿Í»§¶ËIP
memset(&localAddr, 0, sizeof(localAddr));
localAddr.sin_family = AF_INET;
localAddr.sin_addr.s_addr = inet_addr( argv[1]);
localAddr.sin_port = htons (atoi(argv[2]));
int bindResult = bind(socketFd, (struct sockaddr *) &localAddr, sizeof(localAddr));
if ( -1 == bindResult )
{
perror( "bind:" );
close(socketFd);
exit(-1);
}
// ·þÎñÆ÷IP
memset(&svrAddr, 0, sizeof(svrAddr));
svrAddr.sin_family = AF_INET;
svrAddr.sin_addr.s_addr = inet_addr( argv[1]);
svrAddr.sin_port = htons (atoi(argv[2]));
char tempBuff[2048] = {0};
for ( ; ; )
{
// ½ÓÊÕÊý¾Ý
struct sockaddr_in fromAddr;
memset((char *)&fromAddr, 0, (int)sizeof(fromAddr));
socklen_t fromLen = sizeof(fromAddr);
ssize_t result = recvfrom( socketFd, tempBuff, sizeof(tempBuff), 0, (struct sockaddr *)&fromAddr, &fromLen);
if ( -1 == result )
{
perror("recvfrom:");
continue;
}
else
{
printf( "recv data %s successed. data len
Ïà¹ØÎĵµ£º
ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
Ç°ÃæÔÚÒ»¸öÏîÄ¿¿ª·¢ÖÐÓõ½ÁËImageMagick£¬ÎÒÃÇ×Ô¼ºµÄ²âÊÔ»·¾³¶¼Õý³££¬È»ºó¾Í°´ÕÕÎÒÃÇ¿ª·¢»·¾³µÄ°²×°·½·¨°²×°ÁË¿Í»§µÄ²âÊÔ»·¾³£¬µ«ÔÚ´¦ÀíjpegÀàÐÍͼƬµÄʱºò±¨´íÁË¡£»ØÍ·Ò»¿´ÅäÖÃlog£¬¾ÓÈ»²»Ö§³Öjpeg¡£
ImageMagick ÊDZ任ͼƬµÄ¿âȺ£¬Ö§³Öperl£¬C++£¬JAVAµÈµÈÓïÑÔ¡£¿ÉÒ ......
[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 ......
¹«Ë¾ÓиöÓÃARM940T×öµÄÊÖ³Öʽ²úÆ·£¬ÎÒÃÇÒÆÖ²ÁËÒ»¸öuClinuxÉÏÈ¥£¬ÏµÍ³»¹ÊÇÔËÐв»´íµÄ¡£
ÒòΪûÓдøÍø¿Ú£¬Ö»ÓÐUSBת´®¿Ú¿ÉÒÔʹÓã¬ËùÒÔÏëÑ°ÕÒÒ»¸öÎȶ¨µÄ´«Êä;¾¶£¬ÔÚhostºÍdeviceÖ®¼ä½»»»Îļþ¡£ÎÊÁ˺ܶàÈ˶¼²»Çå³þ£¬»¹ÊÇÒª¿¿×Ô¼ºÕÒ½â¾ö·½·¨¡£
ÔÚgoogleÉÏÕÒÁË°ëÌ죬ÖÕÓÚÕÒµ½ÁËÒ»¸ö¿ÉÒÔͨ¹ý´®¿Ú´«ËÍÎļþµÄÈí¼þ£¬Õâ¾ÍÊǹŶ¼ ......