linuxÏÂtcp·þÎñÆ÷Ô´ÂëʾÀý
#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>
struct _NSS_HEADER
{
unsigned short ProtocolVersion; /* ÐÒé°æ±¾ÐÅÏ¢ */
unsigned short MsgType; /* ÏûÏ¢ÀàÐÍ */
unsigned short TransactionNo; /* ´«Êä±àºÅ */
unsigned short PacketLength; /* Êý¾Ý°ü³¤¶È,°üÀ¨Header */
}NSS_HEADER;
void str_echo(int sockfd)
{
ssize_t readLen;
ssize_t writeLen;
char buf[8];
while ( true )
{
readLen = read(sockfd, buf, 8);
if (readLen < 0 && errno == EINTR)
{
continue;
}
else if ( readLen <= 0 )
{
perror( "read:");
return ;
}
printf( "recv data successed. data len: %d\n", readLen );
int nWriteLen = 0;
while ( true )
{
writeLen == write(sockfd, &buf[nWriteLen], readLen-nWriteLen);
if (writeLen < 0 && errno == EINTR)
{
continue;
}
else if ( writeLen < 0 )
{
perror ( "write:" );
return;
}
nWriteLen += writeLen;
// ÒÑдÍֱ꣬½Ó·µ»Ø
if (nWriteLen >= readLen )
{
break;
}
}
printf( "send data successed. data len: %d\n", readLen );
}
}
int main(int argc, char **argv)
{
printf( "server ip: %s\n", argv[1] );
printf( "server port: %s\n", argv[2] );
printf( "\nservice starting ... \n\n" );
int listenfd, connfd;
pid_t childpid;
socklen_t clilen;
struct sockadd
Ïà¹ØÎĵµ£º
LinuxÏÂÅäÖð²×°NFS
http://blog.chinaunix.net/u1/34252/showart_264236.html
1.1NFS¸ÅÊö
NFS(Network File System)ÊÇÒ»ÖÖ·Ö²¼Ê½Îļþϵͳ£¬ÔÊÐíÍøÂçÖеݲװ²»Í¬²Ù×÷ϵͳµÄ¼ÆËã»ú¼ä¹²ÏíÎļþºÍÍâÉ裬ËùÒÔËüµÄͨѶж¨Éè¼ÆÓëÖ÷»ú¼°×÷ҵϵͳÎÞ¹Ø. ËüÊÇÓÉSUN¹«Ë¾ÓÚ1984ÄêÍÆ³ö£¬Ê¹µÃ¿ÉÒÔ±¾µØ»úÒ»ÑùµÄʹÓÃÁíһ̨ÁªÍø¼ÆËã»úµÄÎ ......
ÉÌÒµÖÇÄܹ¤¾ßÊÇ´Ó²»Í¬ÀàÐ͵ÄÊý¾ÝÔ´ÖÐÍÚ¾òÊý¾Ý£¬ÓÃÀ´Éè¼ÆºÍ²úÉú±¨±í¡£ÉÌÒµÖÇÄÜÈí¼þÀàÐÍÒ²ºÜ¶à£¬°üÀ¨±¨±íºÍ²éѯÈí¼þ£¬Êý×ÖÒDZíÅÌ£¬´¦ÀíºÍÊý¾ÝÍÚ¾ò£¬¾Óª¼¨Ð§
¹ÜÀíÒÔ¼°µç×ÓÊý¾Ý±íµÈ¡£Ò»°ãÒ»¸öÉÌÒµÖÇÄÜÆ½Ì¨°üÀ¨Èý¸ö²ãÃæ£ºÊý¾Ý²ã£¬ÉÌÒµÖÇÄܲ㣬·ÖÎö/¼¨Ð§¹ÜÀí²ã¡£±¾ÎĽ«½éÉÜ8¸ö×îºÃµÄLinuxƽ̨ÏÂÉÌÒµÖÇÄÜÈí¼þ£º
Pentaho£ºÌṩÆó ......
¹«Ë¾ÓÐ̨ÔËÐÐCentOS5.3µÄµçÄÔ½ñÔçÆô¶¯µÄʱºòÒ»Ö±Ìáʾ#repair filesystem 1ϵͳÎļþË𻵣¬ÐèÒªÐÞ¸´£¬È»¶øÊ¹ÓÃfsckÐÞ¸´Á˰ëÌ컹ÊÇÎÞ·¨½øÈëXWindow¡£ÕâʱÎÒÐèÒªÓÃÓÅÅÌ¿½±´ÀïÃæ¼¸¸öÎļþ£¬Ë÷ÐÔµ½ÃüÁîÐÐshellÖп½±´µÃÁË¡£¿ÉÊǽøÈ¥mountÉ豸µÄʱºòÈ´ÌáʾÎÒ£ºÏµÍ³ÎļþĿ¼ֻ¶Á£¬ÎÞ·¨´´½¨¹Ò½ÓÉ豸Îļþ......Ôõô° ......
ÓɲÙ×÷ϵͳʵÏÖµÄËùÓÐϵͳµ÷ÓÃËù¹¹³ÉµÄ¼¯ºÏ¼´³ÌÐò½Ó¿Ú»òÓ¦Óñà³Ì½Ó¿Ú(Application Programming Interface£¬API)¡£ÊÇÓ¦ÓóÌÐòͬϵͳ֮¼äµÄ½Ó¿Ú¡£
¡¡¡¡²Ù×÷ϵͳµÄÖ÷Òª¹¦ÄÜÊÇΪӦÓóÌÐòµÄÔËÐд´½¨Á¼ºÃµÄ»·¾³£¬ÎªÁË´ïµ½Õâ¸öÄ¿µÄ£¬ÄÚºËÌṩһϵÁо߱¸Ô¤¶¨¹¦ÄܵĵÄÄں˺¯Êý£¬Í¨¹ýÒ»×é³ÆÎªÏµÍ³µ÷Óõģ¨system call)µÄ½Ó¿Ú³ÊÏÖ¸øÓà ......
linux shell pwd ÏÔʾµ±Ç°Â·¾¶
¼ÙÈôÓÐtest.cpp
g++ test.cpp -o test
./test
ÏëÔÚtestÖÐÕÒµ½µ±Ç°Ö´ÐгÌÐòËùÔڵķ¾¶
¿ÉÒÔÔÙtest.cppÖÐʹÓÃreadlinkº¯Êý
¾ßÌå¼ûÈçÏÂʵÀý£º
#include<iostream>
#include<unistd.h>
#include<dirent.h>
#include<string.h>
#include<string>
using ......