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

°ïæµ÷ÊÔ£¬Ò»Ð¡¶Î×¥È¡ÍøÒ³µÄC³ÌÐò£¡

´ÓÍøÉϳ­µÄÒ»¶Î´úÂ룬
ÓÃÓÚץȡָ¶¨µÄÍøÒ³¡£
´úÂëÈçÏ£º


C/C++ code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

//#ifndef _WIN32
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
//#endif

char* host = "www.baidu.com"; //Ö¸¶¨Îª×¥È¡www.baidu.comÒ³Ãæ
int port = 80;

int main(void)
{
char buffer[4096];
int isock;
struct sockaddr_in pin;
struct hostent * remoteHost;
char message[512];
int done = 0;
int chars = 0;
int l = 0;

if( (remoteHost = gethostbyname(host)) == 0 )
{
printf("Error resolving host\n");
exit(1);
}

bzero(message,sizeof(message));
bzero(&pin,sizeof(pin));
pin.sin_family = AF_INET;
pin.sin_port = htons(port);
pin.sin_addr.s_addr = ( (struct in_addr *)(remoteHost->h_addr) )->s_addr;

if( (isock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
printf("Error opening socket!\n");
exit(1);
}
sprintf(message, "GET / HTTP/1.1\r\n");
strcat(message, "Host:www.baidu.com\r\n");
strcat(message, &q


Ïà¹ØÎÊ´ð£º

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ÓïÑÔ

·Ö±ðÓýṹ»¯·½·¨ºÍÃæÏò¶ÔÏó·½·¨±à³ÌʵÏÖÏÂÃæÒªÇó£º
¶ÔCircleºÍRectangleʵÏÖÒÔϹ¦ÄÜCenter,Move,Rotate,Print.
×Ô¼ºÏȶ©ÒÔÏ£¬ÕâÊÇÒ»¸ö¸Õѧϰ¼ÆËã»úµÄÈËÎÊÎÒµÄ


ѧϰ£¬¿´¿´

¼ÌÐø¶¥Å¶

ѧϰÁË¡£

go o ......

cȺ - C/C++ / ·Ç¼¼ÊõÇø

±¾ÈËѧϰcÒÑÓÐÈýÄêʱ¼ä ÎÒ¸Õ½¨ÁËÒ»¸öȺ ÓжÔc¸ÐÐËȤµÄ¿ÉÒÔ¼ÓÈë »¶Ó­´ó¼ÒȺºÅÊÇ£º91975736
½Ó·Ö

Â¥Ö÷Ҫѧ»á½áÌù£¬½Ó·Ö

ÄãÃDz»ÊÇ»¹Ã»ÓмÓÈëÂð ÎÒ¸ÉÂï½áÌùÄØ ºÇºÇ

QQÊÇʲô£¿Ò»ÖÖʳÎïÂð£¿

ÎÒÏë¼Ó

¼ÓÍêÁ ......

ÈçºÎÓÃC»­Í¼£¬ÄÜ·ñ±àÒ»¸ö¾ßÌåµÄ ¼±ÓÃ

ÈçºÎÓÃC»­Í¼£¬ÄÜ·ñ±àÒ»¸ö¾ßÌåµÄ ¡£
#include <conio.h>
#include <stdio.h>
int main()
{
int i;
char *s[]={"BLACK","BLUE","GREEN","CYAN","RE ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ