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

Linux Socket±à³ÌʵÀý(Ò»¸öHello World³ÌÐò)

      ÔÚLinuxÏÂдÁ˸öСµÄsocket³ÌÐò£¬·ÖΪ¿Í»§¶ËºÍ·þÎñÆ÷¶Ë£¬·þÎñ¶Ë¿ªÒ»¸ö¶Ë¿Ú(20000)£¬×öΪһ¸ödaemon£¬µÈ´ý¿Í»§µÄÁ¬½ÓÇëÇó¡£Ò»µ©Óпͻ§Á¬½Ó£¨¿Í»§¶ËµÄIPºÍ¶Ë¿ÚºÅÊDz»¹Ì¶¨µÄ£©£¬·þÎñÆ÷¶Ë´òÓ¡³ö¿Í»§¶ËµÄIPµØÖ·ºÍ¶Ë¿Ú£¬²¢ÇÒÏò¿Í»§¶Ë·¢ËÍ»¶Ó­ÐÅÏ¢ºÍʱ¼ä¡£
      ÏÂÃæÊÇ·þÎñ¶ËµÄ´úÂë(tcpserver.c)£¬ÓÉÓÚÕâÖ»ÊǸö¼òµ¥µÄ³ÌÐò£¬ËùÒÔÖ»ÓÃÁ˵¥Ïß³ÌʵÏÖ£¡Ð½¨server.c£¬ÄÚÈÝÈçÏ£º
/**
 * Tcp Server program, It is a simple example only.
 * zhengsh 200520602061 2
 * when client connect to server, send a welcome message and timestamp in server.
 */
#include <stdio.h>
#include <sys/socket.h>
#include <unistd.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <time.h>
#define SERVER_PORT 20000 // define the defualt connect port id
#define LENGTH_OF_LISTEN_QUEUE 10 //length of listen queue in server
#define BUFFER_SIZE 255
#define WELCOME_MESSAGE "welcome to connect the server. "
int main(int argc, char **argv)
{
       int servfd,clifd;
       struct sockaddr_in servaddr,cliaddr;
       if ((servfd = socket(AF_INET,SOCK_STREAM,0)) < 0)     //³É¹¦½¨Á¢socket
       {
              printf("create socket error!\n");
              exit(1);
       }
       bzero(&servaddr,sizeof(servaddr));
       servaddr.sin_family = AF_INET;
       servaddr.sin_port = htons(SERVER_PORT);
       servaddr.sin_addr.s_addr = htons(INADDR_ANY);
       if (bind(servfd,(struct sockaddr*)&servaddr,sizeof(servaddr))


Ïà¹ØÎĵµ£º

LinuxÏÂrar tar bz gzµÈÃüÁîѹËõºÍ½âѹÏê½â

Èç¹ûÊÇÒÔtarballÐÎʽ°²×°°²×°£¬È¥rar
ÍøÕ¾ÏÂÔØÏàÓ¦°æ±¾µÄtarball¡£µØַΪ
http://www.rarlab.com/
ÒÔ3.8°æ±¾ÎªÀý£¬Èç¹ûÊÇi386µÄƽ̨,Ö´ÐÐÒÔÏÂÃüÁ
$wget http://www.rarlab.com/rar
/rarlinux-3.8.0.tar.gz

rar
Èí¼þ²»ÐèÒª°²×°£¬Ö±½Ó½âѹµ½/usr/localÏ£¬ÒÔϲÙ×÷ÐèÒªÓÐroot
ȨÏÞ¡£
#tar zxvf rarlinux-3.8.0 ......

linuxÎļþºó׺

Ê×ÏÈҪ˵Ã÷µÄÊÇÔÚLinuxϵͳÖУ¬¿ÉÖ´ÐÐÎļþûÓÐͳһµÄºó׺£¬ÏµÍ³´ÓÎļþµÄÊôÐÔÀ´Çø·Ö¿ÉÖ´ÐÐÎļþºÍ²»¿ÉÖ´ÐÐÎļþ¡£¶øgccÔòͨ¹ýºó׺À´Çø±ðÊäÈëÎļþµÄÀà±ð£¬ÏÂÃæÎÒÃÇÀ´½éÉÜgccËù×ñÑ­µÄ²¿·ÖÔ¼¶¨¹æÔò¡£Ò»°ã
.cΪºó׺µÄÎļþ£¬CÓïÑÔÔ´´úÂëÎļþ£»
.aΪºó׺µÄÎļþ£¬ÊÇÓÉÄ¿±êÎļþ¹¹³ÉµÄµµ°¸¿âÎļþ£»
.C£¬.cc»ò.cxxΪºó׺µÄÎļþ£¬ÊÇC ......

¹ØÓÚ linux ÄÚ´æ

Ê×ÏÈ£¬ÄÚ´æµÄ´óСÔÚlinuxÄÚºËÖеĻñÖª·½·¨
1.ͨ¹ýbootloader µÄ tag mem´«Èë¡£
Setup.c Öеĺ¯ÊýÈçÏ£º
static int __init parse_tag_mem32(const struct tag *tag)
{
if (meminfo.nr_banks >= NR_BANKS) {
printk(KERN_WARNING
"Ignoring memory bank 0x%08x size %dKB\n",
tag->u.mem.start, tag->u.mem ......

LinuxÏÂÅäÖÃʹÓÃSVN


from: http://yangsq.javaeye.com/blog/162649
ƽʱµÄÍŶӿª·¢£¬ÉÙ²»ÁËÒªÓÃÒ»¸öЭ×÷¹¤¾ß¡£¶ÔÓÚÒÔÇ°£¬ÎÞÒÉcvsÊǸöÎÞ´íµÄÑ¡Ôñ£¨ÏñIBMµÄÈ«Çò´úÂëά»¤£©¡£µ«ÊÇ£¬¿Æ¼¼ÔÚ·¢Õ¹Âð£¬ÏÖÔÚÓÐÁ˸üºÃµÄsvnÁË£¬ËùÒÔÖ±½Ó¾ÍÊÇsvn°É¡£ÓйØsvnµÄ¾ßÌåÐÅÏ¢¿ÉÒÔÉÏËüµÄ¹ÙÍø»òwww.subversion.org.cn
ÍøÉϹØÓÚsvnµÄÒ²²»ÉÙ£¬²»¹ý¸Ð¾õ´ó¶¼³ö× ......

LinuxÖ®uptime¡¢topÃüÁî


ÔÚLinuxϵͳÖУ¬uptime¡¢topµÈÃüÁîÅжÏÒ»¸öϵͳµÄ¸ºÔØ¡£load average·Ö±ð¼Ç¼ÁË1¡¢5¡¢15·ÖÖÓµÄϵͳƽ¾ù¸ºÔØ¡£
load average ¶Ô performance µÄÓ°Ïì?
1. Èç¹ûload average/CPUÊýÁ¿ < 3, performance is good
2. Èç¹ûload average/CPUÊýÁ¿ > 5, performance is very bad
  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ