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))
Ïà¹ØÎĵµ£º
mkdir -p /usr/local/svn/to/bakcup
/usr/local/svn/bin/svnadmin hotcopy /usr/local/svn/repos/test /usr/local/svn/to/bakcup --clean-logs
ÏêϸÇë²Î¿¼svn ÊÖ²á:
http://wenku.baidu.com/view/7c4617791711cc7931b71655.html ......
Ê×ÏÈҪ˵Ã÷µÄÊÇÔÚLinuxϵͳÖУ¬¿ÉÖ´ÐÐÎļþûÓÐͳһµÄºó׺£¬ÏµÍ³´ÓÎļþµÄÊôÐÔÀ´Çø·Ö¿ÉÖ´ÐÐÎļþºÍ²»¿ÉÖ´ÐÐÎļþ¡£¶øgccÔòͨ¹ýºó׺À´Çø±ðÊäÈëÎļþµÄÀà±ð£¬ÏÂÃæÎÒÃÇÀ´½éÉÜgccËù×ñѵIJ¿·ÖÔ¼¶¨¹æÔò¡£Ò»°ã
.cΪºó׺µÄÎļþ£¬CÓïÑÔÔ´´úÂëÎļþ£»
.aΪºó׺µÄÎļþ£¬ÊÇÓÉÄ¿±êÎļþ¹¹³ÉµÄµµ°¸¿âÎļþ£»
.C£¬.cc»ò.cxxΪºó׺µÄÎļþ£¬ÊÇC ......
1> ʹÓÃCDPATHÉèÖà cd ÃüÁîµÄ¹¤×÷Ŀ¼
[ramesh@dev-db ~]# pwd
/home/ramesh
[ramesh@dev-db ~]# cd mail
-bash: cd: mail: No such file or directory
[×¢Ò⣺ÔÚµ±Ç°Ä¿Â¼ÏÂѰÕÒMAILĿ¼]
[ramesh@dev-db ~]# export CDPATH=/etc
[ramesh@dev-db ~]# cd mail /etc/mail  ......
ΪÁË·½Ã棬ÎÒдÁ˸ö½Å±¾×Ô¶¯sshµÇ¼Զ¶Ë»úÆ÷£¬ÈçÏ£¬Õâ¸ö½Å±¾ÐèÒª°²×°expect°ü
================================
#!/usr/bin/expect
set timeout 30
spawn ssh -l root 192.168.1.117
expect "password:"
send "nopasswd\r"
interact
================================
set timeout 30
ÉèÖÃ ......
from: http://yangsq.javaeye.com/blog/162649
ƽʱµÄÍŶӿª·¢£¬ÉÙ²»ÁËÒªÓÃÒ»¸öÐ×÷¹¤¾ß¡£¶ÔÓÚÒÔǰ£¬ÎÞÒÉcvsÊǸöÎÞ´íµÄÑ¡Ôñ£¨ÏñIBMµÄÈ«Çò´úÂëά»¤£©¡£µ«ÊÇ£¬¿Æ¼¼ÔÚ·¢Õ¹Âð£¬ÏÖÔÚÓÐÁ˸üºÃµÄsvnÁË£¬ËùÒÔÖ±½Ó¾ÍÊÇsvn°É¡£ÓйØsvnµÄ¾ßÌåÐÅÏ¢¿ÉÒÔÉÏËüµÄ¹ÙÍø»òwww.subversion.org.cn
ÍøÉϹØÓÚsvnµÄÒ²²»ÉÙ£¬²»¹ý¸Ð¾õ´ó¶¼³ö× ......