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

C/C++ ÖеĹØÓÚrecv sendº¯Êý - C/C++ / CÓïÑÔ

ÎÒÃǹ«Ë¾ÓÃTCP ·¢ËÍÊý¾Ýʱ£¬°üÀ¨¼òµ¥ÏûÏ¢£¬¶¼ÓÃÑ­»·¼ÓÕâÁ½¸öº¯Êý£¬ÕâÑùµÄ»°£¬µ±ÏûÏ¢ºÜÉÙʱ£¬¾Í±ØÐëµÃË«·½ÏÈÖ¸¶¨ºÃÏûÏ¢µÄ³¤¶È¡£Ò²¾ÍÊÇ˵µÃ¶à·¢ËÍÒ»´ÎÊý¾Ý¡£·ñÔòË«·½¾ÍËÀËø¡£È«¶¼ÔڵȴýÊý¾Ý¡£
ÇëÎÊһϣ¬ÕâÊÇÕý³£µÄ½â¾ö·½Ê½Ã´£¿
Èç¹ûÓÃÑ­»·£¬ÄÇôÿ´Î·¢ËͶàÉÙÊý¾ÝºÏÊÊÄØ£¿
1. ȷʵÇé¿öÏ£¬recvºÍsend¶¼ÊÇ×èÈûµÄ£¬Ò²¾ÍÊÇ˵Èç¹ûûÓÐÊý¾Ý»áÒ»Ö±µÈÏÂÈ¥¡£
2. winsockûÓÐ×öÈκεĴ«Êä¿É¿¿µÄ±£ÕÏ£¬ËùÒÔÐèÒª×Ô¼ºÈ·±££¬¿ÉÒÔ½«Êý¾Ý´ò°ü³ÉÒ»¸ö½á¹¹Ì壬ǰÃæÌí¼ÓһЩ¿ØÖÆÍ·ÐÅÏ¢£¬ÏȽÓÊÕ»ò·¢ËÍÕⲿ·Ö¶«Î÷¡£
3. Ò»°ãÀ´Ëµ£¬²»½¨ÒésendºÍrecvдÔÚͬһ¸öÏß³ÌÀÕâÑùÏ໥µÈ´ýºÜ²»ºÃ¡£

ÊÕ·¢Ò»°ãʹÓò»Í¬µÄÏ̡߳£»òÕßʹÓÃselect¾Í¿ÉÒÔ·ÅÔÚͬһ¸öÏß³ÌÁË¡£
Èç¹ûʹÓõÄÊÇtcp£¬Ò»°ãÒªÓÐ×Ô¼º¶¨ÒåµÄ¹æÔòÈ¥·Ö¸ôÊý¾ÝÁ¿µÄƬ¶Î¡£·ñÔò½ÓÊÕ·½ÎÞ·¨ÖªµÀºÎʱ½ÓÊÕÒ»¸öÍêÕûµÄ°ü¡£
ÖÁÓÚÈçºÎ·Ö¸ôÊý¾ÝÁ÷£¬¶øÒѸ½¼ÓÒ»¸ö³¤¶È£¬»òÕßÆðʼ½áÊø·û¡£


Ïà¹ØÎÊ´ð£º

linux»·¾³ÏÂgethostbynameº¯ÊýÎÊÌâ - C/C++ / CÓïÑÔ

дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
   
  struct hostent *hp; 
char AlarmDevIP[20];  
  int x2;

hp = gethostbyname("www.google.com");
if (hp)
{ ......

¸ÕѧÍêCµÄ»ù´¡£¬ÇóÏÂÒ»²½ - C/C++ / CÓïÑÔ

ÎÒ¸Õ°ÑÌ·ºÆÇ¿µÄµÚÈý°æµÄÊéѧÍ꣬ÎÒÖªµÀµÄÓÐC++£¬CºÍÖ¸Õë CȱÏݺÍÏÝÚå Cר¼Ò±ä³É£¬»¹ÓÐÊý¾Ý½á¹¹£¬ÎÒÏëÎÊÎÊÎÒÓ¦¸ÃÒÔʲô˳ÐòÀ´Ñ§ÄØ
CȱÏݺÍÏÝÚå Cר¼Ò±à³Ì
Êǽø½×µÄ£¬²»Óü±×Å¿´
ÖÁÓÚ
CºÍÖ¸Õë 
Äã²»Àí½âÖ ......

CÖÐÈçºÎÅжÏdoubleÐÍÊý×éΪ¿Õ - C/C++ / CÓïÑÔ

[align=center][/align]CÓïÑÔÖÐÈçºÎÅжÏÒ»¸ödoubleÐ͵ÄÊý×飨Èçdouble S[20]£»£©ÊÇÒ»¸ö¿ÕÊý×飬¼´Êý×éÖÐûÓзÅÈκÎÖµ¡£
û°ì·¨¡£

"ÈκÎÖµ" µÄ¶¨Òå?

¾ÍÊÇÊý×éÊǿյģ¬Ã»ÓÐΪËü¸³Öµ

¿ÉÒÔ¿¼Â ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ