LinuxÏÂÃæSocket±à³ÌµÄÎÊÌâ
http://hqlong.com/2009/06/800.html/comment-page-1 ¿´µ½ÁËÕâƪ½Ì³Ì£¬¿ÉÊÇÓÐһЩ²»Àí½âµÄ£¬×¢ÊͳöÀ´ÁË£¬ÔÚwhileÑ»·ÀïÃ棬ϣÍû´ïÈËÄܽâÊÍÒ»ÏÂ
C/C++ code:
#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>
#define SERVPORT 3333
#define BACKLOG 10
#define MAXSIZE 1024
int main() {
int sockfd,client_fd;
struct sockaddr_in my_addr;
struct sockaddr_in remote_addr;
//´´½¨Ì×½Ó×Ö
if ((sockfd = socket(AF_INET,SOCK_STREAM,0)) == -1) {
perror("socket create failed!");
exit(1);
}
//°ó¶¨¶Ë¿ÚµØÖ·
my_addr.sin_family = AF_INET;
my_addr.sin_port = htons(SERVPORT);
my_addr.sin_addr.s_addr = INADDR_ANY;
bzero(&(my_addr.sin_zero),8);
if (bind(sockfd, (struct sockaddr*)&my_addr, sizeof(struct sockaddr)) == -1) {
perror("bind error!");
exit(1);
}
//¼àÌý¶Ë¿Ú
if (listen(sockfd, BACKLOG) == -1) {
perror("listen error");
exit(1);
}
while (1) {
int sin_size = sizeof(struct sockaddr_in);
if ((client_fd = accept(sockfd, (struct sockaddr*)&remote_addr,&sin_size)) == -1) {
Ïà¹ØÎÊ´ð£º
LinuxÐÂÊÖ£¬Çë´ó¸ç´ó½ã²»Òª¼ûЦ¡£
ÎÒÓÃrootÓû§µÇ¼µ½Linuxϵͳ¡£ÔÚ¸ùĿ¼ÏÂÃ潨ÁËĿ¼dir1£¬ºóÓÃÃüÁîcd /dir1½øÈëµ½dir1Ŀ¼Ï£¬È»ºóÔÙÓÃmkdir dir2½¨Á¢ÁËĿ¼dir2 £¬ÔÙºóÀ´ÓÃÃüÁîcd /dir2ÊÇ£¬ÌáʾΪ£º-bush ......
ÎÒÔÚLINUXÉÏÓÐÁ½¸öÓû§
Ò» root
¶þ myadmin
¡¾myadmin@localhost~¡¿$ dir
Desktop myphp
[myadminlocalhost~]$ cd myphp¡¢DesktopÄܽøÈ¥ÆäËûµÄϵͳĿ¼½ø²»È¥
Ö»ÓÐÕâÁ½¸öĿ¼ ÎÒÏë½øÈëÆäËûµÄÏ ......
Çë½Ì£º
ÔÚ LINUXϵͳÖеÄORACLEÔõôн¨±í¿Õ¼ä£¿
Ò»ÑùµÄÃüÁî°¡¡£Èç¹ûûÓÃomfµÄ»°£¬Äã¾ÍÖ¸¶¨Ï·¾¶ºÍÊý¾ÝÎļþÃû¾ÍÐÐÁË¡£
create tablespace xxx datafile '/u01/..../aaa.dbf' size 10m;
CREATE TA ......
ÔÚlinuxÏÂдµÄһЩС³ÌÐòºÍ½Å²½£¬Ã¿´ÎÒªÔËÐж¼ÓÐÇл»µ½ËüËùÔÚµÄĿ¼£¬
ÔõÑùÈÃËüÔÚÆäËûĿ¼Ҳ¿ÉÒÔÓÃÄØ£¿¾ÍÈçÓÃvi»òlsÕâЩÃüÁîÒ»Ñù
³¢ÊÔ¹ýÌí¼Ó»·¾³±äÁ¿£¬µ«²»³É¹¦£¬²»¶®
ûÓÐÈ˻شð
ÏñviÄÇЩ£¬ËüÃÇËùÔÚµÄĿ¼¶¼Å ......
RT
javaµÄһЩ½çÃæÊÇ·½¿é¡£Ó¦¸ÃÊÇ×Ö·ûÎÊÌâ°É¡£
ÎÒÓõÄÊÇFedora11.ÇëÎÊÔõô½â¾ö°¡£¿
°££¬Ã»ÓÐÈ˻شðÎÒ
òËÆlinuxϵÄ×Ö·ûÊÇutf-8 ÊÇÓÃeclipseô£¿ ÊǵĻ°£¬°ÑËü¸Ä»Øgbk¾Í¿ÉÒÔÁË¡£
ϵͳÖÐÎÄ×ÖÌå°²×°ÁËÂð£¿
Ä ......