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

¹ØÓÚlinuxÏÂsocket±à³ÌµÄÎÊÌ⣡ - C/C++ / CÓïÑÔ

ÓÉÓÚÎҲŸոսӴ¥socket±à³Ì£¬×Ô¼ºÐ´ÁËÒ»¸ö¼òµ¥³ÌÐò£¬µ«¾ÍÊÇÔÚÔËÐеÄʱºò³öÏֶδíÎó£¬ÎÞ·¨½â¾ö£¬ÏÖÔÚÎÒ°ÑÔ´´úÂëÌù³öÀ´£¬Çë¸÷λ´óϺָÕýһϣ¡Ð»Ð»£¡
#include<stdio.h>

#include<stdlib.h>

#include<errno.h>

#include<string.h>

#include<sys/types.h>

#include<netinet/in.h>

#include<sys/socket.h>

#include<sys/wait.h>



#define SERVPORT 3333

#define BACKLOG 10



main()

{

int sockfd,client_fd;

int *sin_size;

struct sockaddr_in my_addr;

struct sockaddr_in remote_addr;

if((sockfd = socket(AF_INET,SOCK_STREAM,0)) == -1)

{

perror("socket make error");

exit(1);

}

my_addr.sin_family = AF_INET;

my_addr.sin_port = htons(SERVPORT);

my_addr.sin_addr.s_addr = INADDR_ANY;

bzero(&(my_addr.sin_zero),8);

if(bind(sockfd,(struct sockaddr*)&my_addr,sizeof(struct sockaddr)) == -1)

{

perror("bind error");

exit(1);

}

if(listen(sockfd,BACKLOG) == -1)

{

perror("listen error");

exit(1);

}

while(1)

{

*sin_size = sizeof(struct sockaddr_in);

if((client_fd = accept(soc


Ïà¹ØÎÊ´ð£º

ѧϰÌÖÂÛ C/C++ QQȺ - C/C++ / ·Ç¼¼ÊõÇø

QQȺ 29152388
ÓÑÇéUP

°ï¶¥

up

°ïup

up Ö§³Ö£¡

up jf

...ÄѵÀÓзÖ..?

up up up
Ï£ÍûÓеüӷ֣¬¹þ¹þ¡£

Ö§³Ö£¬ÎÒ¼ÓÁË£¬Ï£ÍûÂ¥Ö÷ÄܼÓÎÒ£¬¹²Í¬Ñ§Ï°¹þ

¼ÓÁË¡£

¶¥ÉÏ£¬Ã¿ÌìÊÕ»ñÒ»µã£¬Ö§³Ö ......

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

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

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

c#¿ØÖÆMysql ʵÏÖ×Ô¶¯É¾³ý¹¦ÄÜ - .NET¼¼Êõ / C#

Óиöwinform³ÌÐò,ʹÓÃc#+mysql,ÐèÒªÔÚÒ»¸ö´°ÌåÉèÖÃmysql×Ô¶¯É¾³ý¹¦ÄÜ,°üÀ¨×Ô¶¯É¾³ý¶àÉÙÌì֮ǰµÄÊý¾ÝÒÔ¼°ÊÇ·ñ¿ªÆô×Ô¶¯É¾³ý¹¦ÄÜ,ÎÒ³ÌÐòÍ˳öºó,»¹Ôõô¿ØÖÆMysql×Ô¼ºÉ¾³ý°¡?ÊDz»ÊÇÒªÓÃmysqlµÄeventÀ´ÊµÏÖ?c#¿ÉÒÔµ÷ÓÃmysq ......

C ³ÌÐòÎÊÌ⣨ËÄ£© - C/C++ / CÓïÑÔ

#include "stdio.h"
int main()
{
  char *ch(char *, char *);
  char str1[]="I am glad to meet you!";
  char str2[]="Welcom to study C!";
&nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ