Çë½Ì´ó¼Ò£¬Õâ¸ö¸Ä³É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)
{
......
ÔÚ¸ùĿ¼/libÖдæ·ÅÒ»¸ölog.c£¬log.h£¬²¢ÓÃÏÂÃæµÄÓï¾ä£º
gcc -c log.c
ar crv liblog.a log.o
±àÒë³öÒ»¸öliblog.a¾²Ì¬¿â£¬È»ºóÔÚÎļþ¼Ð£º/testfileÖд´½¨Ò»¸ötest.cºÍtestc.c£¬test.cÖÐÒýÓÃÁËtestc.cÖж¨ÒåµÄ·½·¨ ......
ͦ·±Ëö£¬Ö®Ç°·¢µÄÌû×Ó£¬·Öֵ̫µÍÏÖÔÚÖØ·¢Ò»¸ö¡£»¶Ó¸÷λ´óÏÀ~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[] ......
visual c++2008Ëٳɰ棬²»ÄܱàÒëC³ÌÐòÂð£¿Èç¹ûÄÜÊÇÔõô¿ªÊ¼µÄ°¡£¿ÓÃËü´øµÄÃüÁîÌáʾµ¥Ôª³ýÍâ ¡£
н¨¹¤³Ì£¨¿Õ¹¤³Ì»òwin32¿ØÖÆ̨£©
¾ø¶Ô¿ÉÒÔ¡£½¨Á¢win32¿ØÖÆ̨³ÌÐò¾Í¿ÉÒÔ
ÒýÓÃ
н¨¹¤³Ì£¨¿Õ¹¤³Ì»òwin32¿ØÖÆ̨£ ......
ÔھƵê¹ÜÀíϵͳÖÐ,ÓÐÒ»¸ö¶ÔÄÚµÄϵͳ,¹©Ç°Ì¨·þÎñÔ±ºÍ¾ÀíʹÓÃ
»¹ÓÐÒ»¸ö¾ÍÊǶÔÍâ,Èÿͻ§¿ÉÒÔÔÚÍøÉÏÔ¤¶©·¿¼ä,
ËüÃÇÖ®¼äÊÇÔõôͨѶµÄ.?µ±ÎÒÌá½»Ô¤¶©·¿¼äÐÅÏ¢µÄʱºò,
ÔÚ¶ÔÄÚµÄϵͳÖÐ,ÈçºÎÖªµÀÎÒÒѾÌá½»ÁËÐÅÏ¢¹ýÈ¥.Ê¹Ç ......