linuxϵĶ˿ÚɨÃè¼¼Êõ£¡
Õâ¸öÊÇÎÒÔÚÒ»±¾ÊéÉÏ¿´µ½µÄ£¬ÆäÖеÄһЩ´úÂëÎÒÓÐËù¸Ä±ä£¬Ð´¸ø¸÷λºÃÓѹ²Ïíһϣ¡
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include "my_recv.h" // ×Ô¶¨ÒåµÄÍ·Îļþ
#define SERV_PORT 4507 // ·þÎñÆ÷¶ËµÄ¶Ë¿Ú
#define LISTENQ 12 // Á¬½ÓÇëÇó¶ÓÁеÄ×î´ó³¤¶È
#define INVALID_USERINFO 'n' // Óû§ÐÅÏ¢ÎÞЧ
#define VALID_USERINFO 'y' // Óû§ÐÅÏ¢ÓÐЧ
#define USERNAME 0 // ½ÓÊÕµ½µÄÊÇÓû§Ãû
#define PASSWORD 1 // ½ÓÊÕµ½µÄÊÇÃÜÂë
struct userinfo { // ±£´æÓû§ÃûºÍÃÜÂëµÄ½á¹¹Ìå
char username[32];
char password[32];
};
struct userinfo users[ ] = {
{"linux", "unix"},
{"4507", "4508"},
{"clh", "clh"},
{"xl", "xl"},
{" "," "} // ÒÔÖ»º¬Ò»¸ö¿Õ¸ñµÄ×Ö·û´®×÷ΪÊý×éµÄ½áÊø±êÖ¾
};
// ²éÕÒÓû§ÃûÊÇ·ñ´æÔÚ£¬´æÔÚ·µ»Ø¸ÃÓû§ÃûµÄϱê,²»´æÔÚÔò·µ»Ø-1£¬³ö´í·µ»Ø-2
int find_name(const char *name)
{
int i;
if (name == NULL) {
printf("in find_name, NULL pointer");
return -2;
}
for (i=0; users[i].username[0] != ' ';i++) {
if (strcmp(users[i].username, name) == 0) {
return i;
}
}
return -1;
}
// ·¢ËÍÊý¾Ý
void send_data(int conn_fd, const char *string)
{
if (send(conn_fd, string, strlen(string), 0) < 0) {
my_err("send", __LINE__); // my_errº¯ÊýÔÚmy_recv.hÖÐÉùÃ÷
}
}
int main()
{
int sock_fd, conn_fd;
int optval;
int flag_recv = USERNAME; // ±êʶ½ÓÊÕµ½µÄÊÇÓû§»¹ÊÇÃÜÂë
int ret;
int name_num;
pid_t pid;
socklen_t&
Ïà¹ØÎĵµ£º
²ËÄñ¾ÍÊDzËÄñ£¬Ê²Ã´ÎÊÌⶼÄÜÓöµ½°¡¡£¡£¸ÕÏëѧϰÏÂlinux ¾ÍÓöµ½ÕâÖְ׳ÕÎÊÌ⣬°Ù¶ÈÏ »¹ÊÇÓнáÂÛµÄÂ𡣺ǺÇ
ÒÔÏÂΪ²ÎÕյĽâ¾ö·½°¸£º
¿ÉÒÔÒÔµ¥Ò»Ê¹ÓÃÕßµÄģʽµÇÈ룬ȻºóÔÙ½¨Á¢Ò»¸öеÄrootÃÜÂë¡£
Òª½øÈ뵥һʹÓÃÕßģʽ£¬ÇëÏÈÖØÐÂÆð¶¯ÄúµÄµçÄÔ£¬¼ÙÈçÄúʹÓÃÔ¤µ÷µÄ¿ª¹Ø¹ÜÀí³ÌʽGRUB£¬Äú¿ÉÒÔÖ´ÐÐÏÂÁеĶ¯×÷À´½øÈ뵥һʹÓÃÕßÄ£Ê ......
ÓÃSSHµÇ½Զ³ÌµÄlinux·þÎñÆ÷»òÓÃwinä¯ÀÀÔËÐÐsambaµÄlinux·þÎñÆ÷ÖÐÓÐÖÐÎÄÃûµÄÎļþ¼ÐµÄʱºò£¬¿´µ½ÀïÃæµÄÖÐÎÄÎļþÃû¶¼ÊÇÂÒÂ룬±à¼ÎĵµµÄʱºò¶¼ÊÇ´®Ðеģ¬Ã¿´ÎÒªexport LANG=enÂé·³ËÀÁË¡£
ÉÏÍøËÄ´¦ËÑË÷£¬Çó½Ì¸ßÈË£¬µÃ´Ë°ì·¨¡£
(1) ´ò¿ª/etc/sysconfig/i18n
ÉèÖÃΪ£º
LANG="zh_CN.GB2312"
LANGUAGE="zh_CN.GB18030:zh_CN ......
1¡¢¼òµ¥µÄ²éÕÒ²¢Ì滻ΪеÄ×Ö·û´®
:%s/²éÕÒµÄ×Ö·û´®/еÄ×Ö·û´®/g
eg£º²éÕÒ“liliang” ²¢½«ÆäÌ滻Ϊ“liangli”
:%s/liliang/liangli/g
ÆäÖГ\”ΪתÒå·û
eg£º²éÕÒ“li/liang” ²¢½«ÆäÌ滻Ϊ“liliang”(¼´°Ñ±»²éÕÒ×Ö·û´®ÖеÄб¸ÜÈ¥µô)
:%s/li\/liang/liliang ......
¸øËùÓÐÓû§Ìí¼Ó¿ÉÖ´ÐеÄȨÏÞ
#chmod +x jdk-1_5_0_02-linux-i586.rpm.bin
#./jdk-1_5_0_02-linux-i586.rpm.bin
´Ëʱ»áÉú³ÉÎļþjdk-1_5_0_02-linux-i586.rpm£¬
ͬÑù¸øËùÓÐÓû§Ìí¼Ó¿ÉÖ´ÐеÄȨÏÞ
#chmod +x jdk-1_5_0_02-linux-i586.rpm
-------------ÍøÉϲ鵽£¬Òª½øÐÐÏÂÃæÒ»²½£¬ÎÒÔÙ./jdkʱºò¾ÍÒѾ³öÏÖÐÒéÁË£¬Ò²¾ÍÊÇÒ ......
1.ÏÂÔØmemcached·þÎñÆ÷¶Ë°²×°Îļþ
°æ±¾£º
memcached-1.4.2.tar.gz
ÏÂÔصØÖ·£ºhttp://www.danga.com/memcached/download.bml
2.ÏÂÔØlibevent£¬memcachedÐèÒªÓõ½socked£¬ÒÀÀµ´Ë°²×°Îļþ¡£
°æ±¾£º
libevent-1.4.12-stable.tar.gz
ÏÂÔصØÖ·£ºhttp:/ ......