Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linux socketСÀý

/*
socket selectÄ£ÐÍ£¬·þÎñ¶Ë
¾ø´ó¶àÊý×¢ÊÍ×Ô¼ºÐ´µÄ£¬²Î¿¼man
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/un.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <netinet/in.h>
#define SERVPORT 3333
#define BACKLOG 10
#define MAX_CONNECTED_NO 10
#define MAXDATASIZE 100
int main()
{
/*
struct sockaddr_in {
//µØÖ·×åAF_INET£¨IPv4£©AF_INET6£¨IPv6£©AF_LOCAL£¨UNIXÓòЭÒ飩AF_LINK£¨Á´Â·µØַЭÒ飩AF_KEY£¨ÃÜÔ¿Ì×½Ó×Ösocket£©AF_APPLETALK£¨ddp£©
¡¡¡¡ short int sin_family;
//¶Ë¿ÚºÅ
¡¡¡¡ unsigned short int sin_port;
*
* struct in_addr {
* unsigned long s_addr;
* }
*
//µØÖ·
struct in_addr sin_addr;
unsigned char sin_zero[8];
}
eg:
struct sockaddr_in ina;
bzero(&ina,sizeof(ina));
ina.sin_family=AF_INET;
ina.sin_port=htons(23);
ina.sin_addr.s_addr = inet_addr("132.241.5.10");
AF_INETºÍPF_INETÂÔÓвîÒì
*/
struct sockaddr_in server_sockaddr,client_sockaddr;
int sin_size,recvbytes;
fd_set readfd;
fd_set writefd;
int sockfd,client_fd;
char buf[MAXDATASIZE];
/*
int socket(int domain, int type, int protocol);
domain:PF_INET...
type:SOCK_STREAM,SOCK_STREAM,SOCK_RAW...
protocol:/etc/protocols tcp,udp...
*/
if((sockfd = socket(AF_INET,SOCK_STREAM,0))==-1){
perror("socket");
exit(1);
}
printf("socket success!,sockfd=%d\n",sockfd);
server_sockaddr.sin_family=AF_INET;
server_sockaddr.sin_port=htons(SERVPORT);
server_sockaddr.sin_addr.s_addr=INADDR_ANY;
//set to 0
bzero(&(server_sockaddr.sin_zero),8);
/*
int bind(int sockfd, const struct sockaddr *my_addr,socklen_t addrlen);
sockfd:created by socket
*my_addr:convert from sockaddr_in
addrlen:sizeof(sockaddr)
*/
if(bind(sockfd,(


Ïà¹ØÎĵµ£º

linux api±Ê¼Ç£¨3£©£ºỊ̈߳¨Ò»£©

±¾ÎÄÖн«½²Êölinux»·¾³±à³ÌÖÐÏ̵߳ÄʹÓᣲ»Ëµ·Ï»°Ö±½ÓÉÏ´úÂ룺
#include <pthread.h>
#include <assert.h>
struct ThreadData
{
int i;
};
void * ThreadProc(void* arg)
{
ThreadData* data = static_cast<ThreadData*>(arg);
//do something

pthread_exit(data);
}
int main() ......

linuxÃüÁîÔ´ÂëµÄ²é¿´

ÔÚƽ³£µÄ×÷ÒµÖУ¬ÓÐʱºòÀÏʦÈÃ×Ô¼ºÊµÏÖÖîÈçcatµÈÀàµÄ³ÌÐò£¬ÓÐʱºò½ÐÓÃshellʵÏÖ£¬ÓÐʱºòÓÃcʵÏÖ£¬µ«ÊÇÎÒ¾­³£Ò»µãÍ·Ð÷¶¼Ã»ÓУ¬²»¹ýÎÒÏëµ½linux¿ªÔ´µÄ£¬ÃüÁî´úÂë¿ÉÒÔÄÃÀ´²Î¿¼Ï°¢£¬ËùÒÔÎÒ¾ÍÏë¿´¿´linuxÃüÁîµÄÔ´´úÂ룬ÓÚÊǾͿªÊ¼Á˰ڶɹ·¹·µÄËÑË÷¹ý³Ì¡£´Ó½á¹ûÀ´¿´£¬ÓÐÁ½ÖÖÇé¿ö£¬Ò»ÖÖÊǸøÓèrpmµÄ°üµÄÐÎʽ£»ÁíÒ»ÖÖÊÇ»ùÓÚdeb°üµÄÐ ......

Linux ½ø³Ìµ÷¶È»úÖÆ

ÓÅÏÈȨֻÊǵ÷¶ÈËã·¨¿¼ÂǵÄÒ»¸ö·½Ãæ
½ø³Ìµ÷¶ÈÒÀ¾Ý
µ÷¶È³ÌÐòÔËÐÐʱ£¬ÒªÔÚËùÓпÉÔËÐÐ״̬µÄ½ø³ÌÖÐÑ¡Ôñ×îÖµµÃÔËÐеĽø³ÌͶÈëÔËÐС£Ñ¡Ôñ½ø³ÌµÄÒÀ¾ÝÊÇʲôÄØ£¿ÔÚÿ¸ö½ø³ÌµÄtask_struct½á¹¹ÖÐÓÐÒÔÏÂËÄÏpolicy¡¢priority¡¢counter¡¢rt_priority¡£ÕâËÄÏîÊÇÑ¡Ôñ½ø³ÌµÄÒÀ¾Ý¡£ÆäÖУ¬policyÊǽø³ÌµÄµ÷¶È²ßÂÔ£¬ÓÃÀ´Çø·Öʵʱ½ø³ÌºÍÆ ......

Beyond Compare Under Linux now!

°ëÄêÇ°µÄÏûÏ¢ÁË¡£¡£ºÇºÇ¡£
Ê×ÏÈ·ÃÎÊ£ºwww.scootersoftware.com/
ÔÚdownloadÏÂÃæÕÒµ½¶ÔÓ¦µÄ°²×°°ü£¬Ðµİ汾Ŷ¡£
»òÕßÓÃwgetÒ²ÐÐÀ­¡£¿´¿´°æ±¾µÄ¡£
ÏÂÔغó°²×°¾ÍÐÐÁË¡£
È»ºóÄØ£¬
¸ù¾ÝÍøÉÏ˵µÄ£¬É¾³ýµô ~ ÏÂÃæµÄ .beyondcompare ¾ÍÄܺÍгµô30ÌìµÄÊÔÓÃÆÚ¡£²»¹ý£¬Ã¿¸ö30ÌìÀ´Ò»´Î..
rm -rf ~/.beyondcompare
ºÇºÇ¡£²»´íÀ² ......

windowsÉϵÄlinuxÖ±½Óɾ³ýºó³öÏÖgrubµÄÆô¶¯»­Ãæ

ÔÚwindowsÉϳ¢ÊÔcentosºóÎÒÖ±½Ó¸ø¸ñʽ»¯µôcentos£¬Æô¶¯ÏµÍ³³öÏÖgrubµÄÆô¶¯»­Ã棬ÓÐ2¸ö½â¾ö·½°¸
1£ºÔÚdos»·¾³ÏÂÓÃfdisk /mbr ¼¶¿ÉÒÔÐÞ¸´mbr¼´¿É
2£ºÈç¹ûûdosÅÌÔòÓÃÏÂÃæÃüÁ
  1£©rootnoverify (hd0,0)  //»Ø³µ£¬¼ÇµÃrootnoverifyºóÃæÓиö¿Õ¸ñ
  2£©chainloader (hd0,0)+1 // ¼ÇµÃ»¹ÊÇÓпոñ
  3 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ