Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB
ÈÈÃűêÇ©£º c c# c++ asp asp.net linux php jsp java vb Python Ruby mysql sql access Sqlite sqlserver delphi javascript Oracle ajax wap mssql html css flash flex dreamweaver xml
 ×îÐÂÎÄÕ : linux

linuxÏÂIP v6 tcp·þÎñÆ÷¶ËÔ´ÂëʾÀý

/******************************
*
* server.c
*
******************************/
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<errno.h>
#include<string.h>
#include<netinet/in.h>
#include<sys/wait.h>
#include<unistd.h>
#include<arpa/inet.h>
#include<pthread.h>


#define MAXBUF 1024
#define LISNUM 10
#define DEFULT_PORT 8787

void *connect_to_client(void *data);
struct sockaddr_in6 serv_addr,client_addr;
/**************************/
int main(int argc,char *argv[])
{
int sockfd,new_fd;
unsigned int serv_port;
unsigned int lisnum;
char buf[MAXBUF+1];

printf( "the command is %s [port] [listen_num]\n", argv[0] );

// ¼àÌýÆðʼ¶Ë¿Ú
if ( argv[1] != NULL )
{
serv_port = atoi( argv[1] );
}
else
{
serv_port = DEFULT_PORT;
......

linuxÏÂIP v6 tcp¿Í»§¶ËÔ´ÂëʾÀý

/***********************************
*
*client.c
*
**********************************/

#include<stdio.h>
#include<stdlib.h>
#include<errno.h>
#include<string.h>
#include<sys/types.h>
#include<netinet/in.h>
#include<sys/socket.h>
#include<sys/wait.h>
#include<unistd.h>
#include<arpa/inet.h>
#include<resolv.h>

#define MAXSIZE 1024
//**************main()**************
int main(int argc,char *argv[])
{
int sockfd;
int n;
char recv_buf[MAXSIZE+1];
char send_buf[MAXSIZE+1];
struct timeval tv;
fd_set readfd;

// ²ÎÊýÅжÏ
if ( argc != 3 )
{
printf("USAGE: %s [serv_address][serv_port]\n", argv[0]);
exit(1);
}

// ´´½¨IPV6Ð͵Äsocket
if ( (sockfd = socket(PF_INET6, SOCK_STREAM, 0)) < 0 )
{
perror("socket");
exit(1);
}
......

linuxÏ´óÎļþ¶ÁдԴÂëʾÀý

#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
int main()
{
printf("sizeof(off_t) = %d\n", sizeof(off_t));
int fd = 0;
#if 1
fd = open("/root/test", O_WRONLY | O_CREAT | O_LARGEFILE, 0600);
#else
fd = open("/dev/hda1", O_RDONLY, 0600);
#endif
if (fd > 0)
{
off_t l = 0x200000001LL;
off_t l_new = lseek(fd, l, SEEK_SET);
if (l_new < 0)
printf("l_new =%d\n", l_new);
#if 1
else
write(fd, &fd, sizeof(fd));
#endif
printf("l_new = 0x%.16x\n", l_new);
close(fd);
}
struct stat st;
int ret = stat( "/root/test", &st);
printf( "\n%d--%I64u-\n", ret, st.st_size );
}
......

linuxϹ²ÏíÄÚ´æ(shm)ʹÓÃʾÀý

#include <sys/ipc.h>
#include <stdio.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#define PERM IPC_CREAT //S_IRUSR|S_IWUSR
#include <errno.h>
int main(int argc,char **argv)
{
int shmid[2048];
char *p_addr,*c_addr;
if(argc!=2)
{
fprintf(stderr,"Usage:%s InputString\n\a",argv[0]);
return 1;
}
int i =0;
for ( i = 0; i<1024; i++ )
{
char *p = new char[1024*1024];
if ( NULL == p )
{
printf( "error new\n" );
return -1;
}
}
for ( i =0; i<1026; i++ )
{
if((shmid[i]=shmget(IPC_PRIVATE,/*1610612736*/ 1024*1024,PERM))==-1)
{
fprintf(stderr,"Create Share Memory Error:%s\n\a",strerror(errno));
return 1;
}
{
p_addr=(char*)shmat(shmid[i],0,0);
p_addr[0] = i/1000 + '0' ......

linuxÏÂͳ¼ÆÊ±¼äÀà

class CTimeTickCount
{
public:
CTimeTickCount(int threadIndex, int id )
{
struct timezone tz;
gettimeofday(&m_tvStartTime, &tz);
// m_tmStartTime = ACE_OS::gettimeofday();
m_iThreadIndex = threadIndex;
m_iID = id;
}

~CTimeTickCount()
{
struct timezone tz;
struct timeval tv;
gettimeofday(&tv, &tz);

// ACE_Time_Value currTime = ACE_OS::gettimeofday();
long cost = (tv.tv_sec - m_tvStartTime.tv_sec) * 1000 * 1000;
cost += (tv.tv_usec - m_tvStartTime.tv_usec );

if(cost >= 100 * 1000 )
{
//NVS_DEBUG((NVS_LM_ERROR, "====thread no: %d, cost time: %dms, id: %d.",
// m_iThreadIndex, cost, m_iID));
printf( "====thread no: %d, cost time: ......

SuSE Linux10Éϰ²×°OracleÊý¾Ý¿â

ϵͳҪÇó£º
¡¡¡¡ÄÚ´æ£ºÍÆ¼ö1G
¡¡¡¡Swap·ÖÇø£ºÉèΪÄÚ´æµÄ2±¶
¡¡¡¡/tmp´ÅÅ̿ռ䣺400MBÒÔÉÏÈý
¡¡¡¡´ÅÅ̿ռ䣺Èí¼þ3.5G Êý¾Ý1.2G
¡¡¡¡ËùÐèÈí¼þ£º
¡¡¡¡SuSE Linux10 for x86
¡¡¡¡Oracle database 10gR2 for Linux32
¡¡¡¡Orarun-1.8-109.15.i586.rpmÈí¼þ°ü£¬¿ÉÒÔ´Óhttp://Ftp.novell.com/partners/Oracle/sels-9ÏÂÔØ
    £¨ÓÉÓÚsuse linux 10¼º¾­oracleÈÏÖ¤£¬ËùÒÔorarun rpm°üºÍ°²×°Êý¾Ý¿âËùÓõ½µÄ×鼺¾­ºÍϵͳĬÈϰ²×°¸øÓû§   ÁË£¬µ±È»ÊÇÄãÑ¡ÔñÕâ¸ö²ÅÓÐµÄ add by warden2010)
¡¡¡¡°²×°²½Ö裺
¡¡¡¡1¡¢°²×°SuSE
¡¡¡¡°²×°SuSEÒ»¶¨È·±£°²×°“C/C++Compiler and Tools”Èí¼þ°ü¡£
¡¡¡¡# gcc –version ²é¿´ÊÇ·ñ°²×°¸ÃÈí¼þ°ü
¡¡¡¡2¡¢°²×°ËùÐèÈí¼þ°ü
¡¡¡¡°²×°orarunÈí¼þ°ü
¡¡¡¡#rpm –ivh orarun-1.8-109.15.i586.rpm
¡¡¡¡°²×°libaioºÍlibaio-develÈí¼þ°ü£¬ÕâÁ½¸öÈí¼þ°ü¿ÉÒÔÔÚSuSE Linux DISK4ÖÐÕÒµ½
¡¡¡¡#rpm –ivh orarun-1.8-109.15.i586.rpm
¡¡¡¡#rpm –ivh libaio-devel-0.3.104-3.i586.rpm
3¡¢OracleÓû§ÉèÖÃ
¡¡¡¡µ±orarunÈí¼þ°ü°²×°Ê±£¬»á×Ô¶¯½¨Á¢ÃûΪOracleµÄÓû§£¬ºÍÒ»¸öoinstall×é¡£ÎÒÃÇÖ»ÐèÒª½ ......

SuSE Linux10Éϰ²×°OracleÊý¾Ý¿â

ϵͳҪÇó£º
¡¡¡¡ÄÚ´æ£ºÍÆ¼ö1G
¡¡¡¡Swap·ÖÇø£ºÉèΪÄÚ´æµÄ2±¶
¡¡¡¡/tmp´ÅÅ̿ռ䣺400MBÒÔÉÏÈý
¡¡¡¡´ÅÅ̿ռ䣺Èí¼þ3.5G Êý¾Ý1.2G
¡¡¡¡ËùÐèÈí¼þ£º
¡¡¡¡SuSE Linux10 for x86
¡¡¡¡Oracle database 10gR2 for Linux32
¡¡¡¡Orarun-1.8-109.15.i586.rpmÈí¼þ°ü£¬¿ÉÒÔ´Óhttp://Ftp.novell.com/partners/Oracle/sels-9ÏÂÔØ
    £¨ÓÉÓÚsuse linux 10¼º¾­oracleÈÏÖ¤£¬ËùÒÔorarun rpm°üºÍ°²×°Êý¾Ý¿âËùÓõ½µÄ×鼺¾­ºÍϵͳĬÈϰ²×°¸øÓû§   ÁË£¬µ±È»ÊÇÄãÑ¡ÔñÕâ¸ö²ÅÓÐµÄ add by warden2010)
¡¡¡¡°²×°²½Ö裺
¡¡¡¡1¡¢°²×°SuSE
¡¡¡¡°²×°SuSEÒ»¶¨È·±£°²×°“C/C++Compiler and Tools”Èí¼þ°ü¡£
¡¡¡¡# gcc –version ²é¿´ÊÇ·ñ°²×°¸ÃÈí¼þ°ü
¡¡¡¡2¡¢°²×°ËùÐèÈí¼þ°ü
¡¡¡¡°²×°orarunÈí¼þ°ü
¡¡¡¡#rpm –ivh orarun-1.8-109.15.i586.rpm
¡¡¡¡°²×°libaioºÍlibaio-develÈí¼þ°ü£¬ÕâÁ½¸öÈí¼þ°ü¿ÉÒÔÔÚSuSE Linux DISK4ÖÐÕÒµ½
¡¡¡¡#rpm –ivh orarun-1.8-109.15.i586.rpm
¡¡¡¡#rpm –ivh libaio-devel-0.3.104-3.i586.rpm
3¡¢OracleÓû§ÉèÖÃ
¡¡¡¡µ±orarunÈí¼þ°ü°²×°Ê±£¬»á×Ô¶¯½¨Á¢ÃûΪOracleµÄÓû§£¬ºÍÒ»¸öoinstall×é¡£ÎÒÃÇÖ»ÐèÒª½ ......
×ܼǼÊý:5772; ×ÜÒ³Êý:962; ÿҳ6 Ìõ; Ê×Ò³ ÉÏÒ»Ò³ [604] [605] [606] [607] 608 [609] [610] [611] [612] [613]  ÏÂÒ»Ò³ βҳ
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ