Çë½Ì´ó¼Ò£¬Õâ¸ö¸Ä³Élinux´úÂë - C/C++ / CÓïÑÔ
C/C++ code:
struct timeval timeout;
fd_set writefds;
const char* optival;
int nByte = MAX_REV_SIZE;
writefds.fd_count = 1;
writefds.fd_array[0] = m_sock;
timeout.tv_sec = 10;
timeout.tv_usec = 0;
optival = (const char *)&nByte;
setsockopt(SI->m_sock, SOL_SOCKET, SO_RCVBUF, optival, 4);
status = select(0, NULL, &writefds, NULL,(const struct timeval *)&timeout);
¸ÄÔõô¸Ä£¿Ð»Ð»
writefds.fd_count = 1;
writefds.fd_array[0] = m_sock;
ÕâÁ½¾ä¾ÍÓÐÎÊÌ⣬ºÃÏñ
Äã¾Í²»ÄܺúõØÓÃ
FD_SET(m_sock, &writefds)
ô¡¡
ÁíÍ⣬select µÄµÚÒ»¸ö²ÎÊýÊÇ 1 °É¡¡
ºÃÏñ²»ÓøľÍÄÜÓðɡ£ºÜ¶àµ×²ãµÄ¡£winºÍlinuxÒ»ÑùµÄ¡£
ºÃÏñ²»ÓøÄ
»Ø¸´1Â¥£¬ÊµÔÚ²»Ì«¶®£¬Õâ¸ö´úÂëÒ²ÊDzο¼±ðÈ˵ģ¬winÏ¿ÉÒÔÕý³£Óã¬linux fd_count fd_arrayºÃÏñ²»ÈÏ
»¹ÓÐʲôºÃµÄ°ì·¨£¬Çë½Ì£¬
ͬÒ⣬linux ϶¼ÊÇÕâÑù×ÓÓõİɡ£
ºÃÏñû´í¡£¡£¡£ÊDZàÒë³ö´íÂð£¿ÌùһϴíÎóÂë¿´¿´
1¥˵µÃºÜ¶Ô,ÎÒ¿´Â¥Ö÷Õâ³ÌÐòÊÇÂÒдµÄ°É
ÖйúÓоäÍÁ»°½ÐϹ¸ã
Ïà¹ØÎÊ´ð£º
дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
ÇëÎÊVFPÖÐÈçºÎµ÷ÓÃC/C++º¯Êý£¿
ÄãÒªµ÷ÓÃʲô¹¦Äܵĺ¯Êý£¿Òª¿´¿´VFPÖÐÓÐûÓжÔÓ¦µÄº¯Êý£¬Èç¹ûÓоÍÊ¡×ÅÔÙµ÷ÓÃÁË¡£Èç¹ûûÓУ¬¿ÉÒÔ½«C/C++º¯Êýд¸öDLL»òFLL£¬È»ºóÔÚVFPµ÷Óü´¿É¡£
Ê®¶¹Èý ÀÏʦ£¬Ôõô²ÅÄÜÐÞ¸Ä×Ô¼ºµÄ ......
±¾ÈËÕýÔÚÓÃJava×öÒ»¸öC/S¼Ü¹¹µÄÏîÄ¿£¬
¿ÉÊÇÓÉÓÚÏîÄ¿±È½Ï´ó£¬Ç°ÆڶԼܹ¹µÄÉè¼ÆÓÈÆäÖØÒª£¬ÒòΪºóÆÚ¿ÉÄÜËæʱ»á¼Ó¸ö¹¦ÄÜ»òÕßÈ¥µôijЩ¹¦ÄÜ¡£
ËùÒÔÌصØÑ°ÇóÈçºÎÉè¼ÆC/SµÄ¼Ü¹¹Ê¹³ÌÐò¸ü¼ÓÃæÏò¶ÔÏó¸ü¼ÓÒ×ÓÚά ......
visual c++2008Ëٳɰ棬²»ÄܱàÒëC³ÌÐòÂð£¿Èç¹ûÄÜÊÇÔõô¿ªÊ¼µÄ°¡£¿ÓÃËü´øµÄÃüÁîÌáʾµ¥Ôª³ýÍâ ¡£
н¨¹¤³Ì£¨¿Õ¹¤³Ì»òwin32¿ØÖÆ̨£©
¾ø¶Ô¿ÉÒÔ¡£½¨Á¢win32¿ØÖÆ̨³ÌÐò¾Í¿ÉÒÔ
ÒýÓÃ
н¨¹¤³Ì£¨¿Õ¹¤³Ì»òwin32¿ØÖÆ̨£ ......