Linux ÏÂʵÏÖÁ½¸ö¹ÜµÀË«ÏòÊý¾ÝÁ÷
ÔÎĵØÖ·£ºhttp://www.wangzhongyuan.com/archives/488.html
ÒÔÏÂÊÇÒ»¸öLinux/UnixÏÂÓÉÁ½¸ö¹ÜµÀÌṩ˫ÏòÊý¾ÝÁ÷µÄC³ÌÐò£¬ÕâÊDzÙ×÷ϵͳ¿Î³ÌÖо³£Ê¹ÓõĻù±¾³ÌÐò
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <string.h>
int main()
{
int fd1[2],fd2[2],cld_pid,status;
char buf[200], len;
if (pipe(fd1) == -1) // ´´½¨¹ÜµÀ1
{
printf("creat pipe1 error\n");
exit(1);
}
if (pipe(fd2) == -1) // ´´½¨¹ÜµÀ2
{
printf("creat pipe2 error\n");
exit(1);
}
if ((cld_pid=fork()) == 0) //×Ó½ø³Ì
{
close(fd1[1]); // ×Ó½ø³Ì¹Ø±Õ¹ÜµÀ1µÄдÈë¶Ë
close(fd2[0]); // ×Ó½ø³Ì¹Ø±Õ¹ÜµÀ1µÄ¶Á³ö¶Ë
//×Ó½ø³Ì¶Á¹ÜµÀ1
len = read(fd1[0],buf,sizeof(buf));
printf("\nÕâÊÇÔÚ×Ó½ø³Ì£º×Ó½ø³Ì´Ó¹ÜµÀ1ÖжÁ³öµÄ×Ö·û´® -- %s",buf);
//×Ó½ø³Ìд¹ÜµÀ2
strcpy(buf,"×Ó½ø³ÌдÈë¹ÜµÀ2µÄ×Ö·û´®");
write(fd2[1],buf,strlen(buf));
printf("\nÕâÊÇÔÚ×Ó½ø³Ì£º×Ó½ø³Ì³É¹¦Ð´ÈëÈçÏÂÓï¾ä£º%s\n",buf);
exit(0);
}
else //¸¸½ø³Ì
{
close(fd1[0]); // ¸¸½ø³Ì¹Ø±Õ¹ÜµÀ1µÄ¶Á³ö¶Ë
close(fd2[1]); // ¸¸½ø³Ì¹Ø±Õ¹ÜµÀ2µÄдÈë¶Ë
//¸¸½ø³Ìд¹ÜµÀ1
strcpy(buf,"¸¸½ø³ÌдÈë¹ÜµÀ1µÄ×Ö·û´®");
write(fd1[1],buf, strlen(buf));
printf("miaojing\n");
//¸¸½ø³Ì¶Á¹ÜµÀ2
len = read(fd2[0],buf,sizeof(buf));
printf("\nÕâÊÇÔÚ¸¸½ø³Ì£º¸¸½ø³Ì´Ó¹ÜµÀ2ÖжÁ³öµÄ×Ö·û´® -- %s\n",buf);
exit(0);
}
}
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
·¢²¼Ê±¼ä£º2007.07.30 06:16
À´Ô´£ºÈüµÏÍø
×÷Õߣºsixth
ºÍËùÓеÄÁ÷ÐÐÎı¾±à¼Æ÷Ò»
Ñù£¬Vim ¿ÉÒԺܺõı༸÷ÖÖ×Ö·û±àÂëµÄÎļþ£¬Õ⵱Ȼ°üÀ¨UCS-2¡¢UTF-8 µÈÁ÷ÐÐµÄ Unicode ±àÂ뷽ʽ¡£È»¶ø²»ÐÒµÄÊÇ£¬ºÍºÜ¶àÀ´×Ô
Linux ÊÀ½çµÄÈí¼þÒ»Ñù£¬ÕâÐèÒªÄã×Ô¼º¶¯ÊÖÉèÖ ......
±¾ÎļòÒª½éÉÜÁËJNIµ÷Óù淶£¬¼°³£Óú¯Êý¡£²¢Í¨¹ý¾ßÌåʾÀý³ÌÐòչʾÁËʵÏÖÒ»¸ö±¾µØµ÷ÓõĻù±¾²½Öè¡£
ÒýÑÔ
Java
µÄ³öÏÖ¸ø´ó¼Ò¿ª·¢´øÀ´µÄ¼«´óµÄ·½±ã¡£µ«ÊÇ£¬Èç¹ûÎÒÃÇÓдóÁ¿ÔÓеľ¹ý¹ã·º²âÊԵķÇJava´úÂ룬½«ËüÃÇÈ«²¿ÓÃJavaÀ´ÖØд£¬¿ÖÅ»á´øÀ´¾Þ´óµÄ¹¤×÷Á¿ºÍ³¤
ÆڵIJâÊÔ£»Èç¹ûÎÒÃǵÄÓ¦ÓÃÖÐÐèÒª·ÃÎʵ½Ìض¨µÄÉ豸£¬ÉõÖÁÊǽ ......
1. Ç°ÑÔ
ÒÔÌ«Í·ÖгýÁË6×Ö½ÚÄ¿µÄMACµØÖ·¡¢6×Ö½ÚÔ´MACµØÖ·Í⣬»¹ÓÐÁ½×Ö½ÚµÄÒÔÌ«Ö¡ÀàÐÍÖµ£¬ÈçIPv4Ϊ0x0800£¬ARPΪ0x0806µÈ£¬Íø¿¨Çý¶¯ÊÕµ½ÒÔÌ«Ö¡ºóͨ¹ý½Ó¿Úº¯Êýnetif_receive_skb()(netif_rxʵ¼Ê×îºóÒ²Êǵ÷ÓÃnetif_receive_skb)½»µ½Éϲ㣬¶øÕâ¸ö½Ó¿Úº¯Êý¾ÍÍê³É¶ÔÒÔÌ«Ö¡ÀàÐ͵ÄÇø·Ö£¬½»µ½²»Í¬µÄÐÒé´¦Àí³ÌÐò¡£Èç¹ûÏë×Ô¼º±àдijһ ......
ÔÎĵØÖ·£ºhttp://www.wangzhongyuan.com/archives/487.html
ÒÔÏÂÊÇÒ»¸öLinux/UnixÏÂÏÔʾijһĿ¼ÏÂÎļþÁбíµÄC³ÌÐò£¬Ï൱ÓÚ×î»ù±¾µÄlsÃüÁîµÄ¹¦ÄÜ£¬ÏÔʾµÄÄÚÈݱ¨¸æ¸ÃĿ¼ÏµÄ×ÓĿ¼ÒÔ¼°ÎļþÃû:
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <errno.h>
int m ......