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

C ÓïÑÔ¿ª·¢Çë½Ì

СµÜ×î½üÐèÒªÓÃLINUX C¿ª·¢Ò»¸öSOCKET SERVER,»¹ÓкܶàÎÊÌâûŪÃ÷°×,ÌØÔÚ´ËÇë½Ì´ó¼Ò - -!!......

³ÌÐò´ó¸ÅµÄÊÇÕâÑùµÄ:

Ò»¸öLINUX C SOCKET SERVER,ÓÃÓÚ´ÓÊý¾Ý¿â¶ÁдÊý¾Ý²¢²Ù×÷Ïà¹Ø»º´æ.

¿Í»§¶Ëͨ¹ýTCPÌύһЩÊý¾Ý,·þÎñÆ÷¶ËÐèÒª¸ù¾Ý²»Í¬µÄ²ÎÊýÀ´ÅжϾßÌåÖ´ÐÐʲô²Ù×÷.±ÈÈç˵:¿Í»§¶ËµÄ·¢Ë͵IJÎÊýΪuser.add|tester,ÄÇô¾­¹ý³ÌÐòÅжÏÊǵ÷ÓÃuserÏÂÃæµÄaddÎļþÀ´ÏìÓ¦Õâ¸öÇëÇó,addÎļþÀïÊÇһЩҵÎñÂß¼­µÄ´úÂë,Ò²Ðí»áµ÷Óõ½libĿ¼ÏµÄlib_user......(lib_user¿ÉÄÜÊǸöº¯Êý¿â....¿âÎļþ),ÍùÊý¾Ý¿âÀïдÈëÒ»¸ötesterÓû§,²¢¸æËß¿Í»§¶ËÊÇ·ñ³É¹¦.

client (·¢ËÍÊý¾Ý [user.add|tester] ) -> linux socket server (Á¬½ÓÊý¾Ý¿â²¢ÅжϿͻ§¶ËÇëÇóµÄÊÇʲô²Ù×÷²¢µ÷ÓÃÏàÓ¦µÄ³ÌÐò¶ÎÀ´ÏìÓ¦ [userĿ¼Ï嵀 add]) -> user/add (µ÷Óà user¿âÀïµÄ add º¯Êý) -> ֪ͨ¿Í»§¶Ë²Ù×÷½á¹û.....

Õâ¸ö¹ý³ÌÖиÃsocket server¸ÃÈçºÎµ÷ÓÃuserĿ¼Ï嵀 add ³ÌÐòÎļþ,addÎļþÈçºÎµ÷ÓÃuser¿âÀïµÄaddº¯Êý......
СµÜÒÔÇ°Ò»Ö±×öWEB¿ª·¢,ËùÒÔÈç¹ûÁ÷³ÌÓдí,´ó¼ÒÇë²»ÁßÖ¸³ö......

add³ÌÐòÎļþÊÇ¿ÉÖ´ÐÐÎļþ?

Á÷³ÌûÓÐʲôÎÊÌâ

²»Ò»¶¨,ÒòΪĿǰÎÒÖ»ÊÇÕâÑùÏëµÄ

Ò²ÐíÎÒ±í´ï²»Çå,ÓÃPHPд¸öÁ÷³Ì°É

/sbin/server.php
/lib/user/lib_user.php
/bin/user/add.php

server.php½ÓÊܲÎÊý(user.add|tester),Á¬½ÓÊý¾Ý¿â¶ÔÏó($db),²¢¸ù¾Ý²ÎÊý

include bin/user/add.php

add.php µ÷Óà /lib/user/lib_user.php ÖÐµÄ add º¯Êý (´Ë´¦ÐèÒªÊý¾Ý¿â¶ÔÏóµÄ±äÁ¿)

.......

×îºó·µ»Ø½á¹û

Ç°¶Îʱ¼ä²é¹ýµã×ÊÁÏ,ºÃÏñ˵ /lib/user/lib_u


Ïà¹ØÎÊ´ð£º

c»ù´¡

#include <string.h>
#include <stdio.h>

void main()
{
int i;
char buf[]="abcde";
strncpy(buf,"abc",3);
for(i=0;i <5;i++)
printf(&q ......

ÏëѧC¡£ µ«ÊÇÈ´ÊÇÓеãÄ£ºý¡£

ÎÒΪÁËÈëÃÅѧÁËVB¡££¨ÒòΪѧУֻװÁËVB ¡£¡£¡££©

ÏÖÔÚÏëתC¡£

µ«ÊÇC¸úVBÍêÈ«²»Í¬¡£

VB¸ø°´Å¥±àдʼþÊÇÖ±½ÓË«»÷¡£

¶øCÎҾͲ»ÖªµÀÔõô±àÁË¡£¡£¡£

ÓÐÄÄλºÃÈËÔ¸Òâ¸ø¸öÊÓƵô ¡£¡£¡ ......

cÊý¾ÝÀàÐÍÎÊÌ⣬¶®µÃÅóÓѽøÀ´¿´¿´£¬Ð»Ð»

ÓÃdev-c++±àÒëµÄ
ÊÇc primer plus µÄÀýÌâ
³ÌÐòÈçÏ£º
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    unsigned int un = 3000000000; /* 32λint ......

ÇëÎÊÎÒдµÄc³ÌÐòÔõôÓÐÕâô¶àµÄwarning£¿£¿

warningÓÐ8¸ö£¬µ«ÊDz»Öªµ½ÊÇÔõô»ØÊ£¬warning¾ßÌåÈçÏ£º
newNode1=(graph)malloc(sizeof(struct node));¶ÔÓ¦µÄΪ£º
incompatible implicit declaration of built-in function 'malloc'

int M= ......

CÖ¸ÕëÎÊÌâ

º¯ÊýÊÇ ÓÃlistdelete()·µ»Øe Èç¹ûtype *e²»¼ÓNULL ÔòÌáʾÏÈʹÓà ¼ÓÁ˺óΪʲôÔÚ½á¹ûºó»¹ÓÐÒ»¸öNULL pointer assignment  ÔõôÈÃËü²»¾¯¸æ ½á¹ûÒ²²»ÏÔʾNULL pointer assignment£¿

void main(){
  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ