Linux TCP Socket³ÌÐò·ÖÎö
/************************
cÓïÑÔ±àдµÄtcp socketͨÐŵÄserver¶Ë¡£
¿ÉÒÔ³ÖÐø¼àÌýmyprotÖ¸¶¨µÄ¶Ë¿Ú
´òÓ¡¶Ë¿Ú½ÓÊÕµ½µÄ×Ö·ûÁ÷
Í·ÎļþÒòΪ¼âÀ¨ºÅ±»×ªÒ壬ËùÒÔÓÃÁËÒýºÅ
************************/
#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"
int main(int argc,char **argv)
{
int sockfd, new_fd;
struct sockaddr_in my_addr;
struct sockaddr_in their_addr;
unsigned int sin_size,myport,listnum;
myport = 9785; //°ó¶¨µÄ¶Ë¿ÚºÅ
listnum = 10;
/*************************************************
Socket½Ó¿Ú£ºÊÇTCP/IPÍøÂçµÄAPI£¬Socket½Ó¿Ú¶¨ÒåÁËÐí¶àµÄº¯Êý£¬¿ÉÒÔ
ÔÚ´Ë»ù´¡ÉÏ¿ª·¢InternetÉϵÄTCP/IPÍøÂç±à³Ì
Create Socket: int socket(int domain, int type, int protoco);
Argument Description:domain Ö¸Ã÷ËùÓÐÐÒé×壬ͨ³£ÊÇPF_INET(TCP/IPV4)
µ±È»ËûÒ²¿ÉÒÔÖ§³ÖIPV6£¬ºÍ¸ü¶àµÄÍøÂçÐÒ飬¸ù¾Ý
¾ßÌåµÄÓ¦ÓÃÀ´Ñ¡Ôñ
type ·ÖSOCK_STREAM(TCP),SOCK_DGRAM(UDP),SOCK_RAW
Ïà¹ØÎĵµ£º
linuxËÑË÷·¾¶: Èç¹ûÓõÄshellÊÇbash,Ôò»·¾³±äÁ¿¼ÓÔØ
1./etc/profile
2.Óû§homeĿ¼ÏÂÃæµÄ.bash_profile
3.Óû§homeĿ¼ÏÂÃæµÄ.bash_login
gcc -I<includeĿ¼>
POSIXϵͳҲ¿ÉÒÔ½¨Á¢»·¾³±äÁ¿
......
fopen("/var/spool/cron/tmp","w+");
/////////////////////////////////////////
££i nclude <sys/types.h>
££i nclude <sys/stat.h>
££i nclude <fcntl.h>
££i nclude <unistd.h>
££i nclude <stdio.h>
££i nclude <string.h>
££i nclude <stdlib.h>
int main(){
in ......
Ò»¡¢rpm°ü°²×°·½Ê½²½Ö裺
1¡¢ÕÒµ½ÏàÓ¦µÄÈí¼þ°ü£¬±ÈÈçsoft.version.rpm£¬ÏÂÔØµ½±¾»úij¸öĿ¼£»
2¡¢´ò¿ªÒ»¸öÖÕ¶Ë£¬su -³ÉrootÓû§£»
3¡¢cd soft.version.rpmËùÔÚµÄĿ¼£»
4¡¢ÊäÈërpm -ivh soft.version.rpm
¶þ¡¢deb°ü°²×°·½Ê½²½Ö裺
1¡¢ÕÒµ½ÏàÓ¦µÄÈí¼þ°ü£¬±ÈÈçsoft.version.deb£¬ÏÂÔØµ½±¾»úij¸öĿ ......